On the contrary, your increment of the %i variable occurs at the beginning of the loop, not the end.

Genius' suggestion requires another variable that is initialized before the loop (as your current variables are being initialized already), then incremented when there is a match. You don't have an increment that occurs when the if statement is true.

Code:
ON *:TEXT:*script*:?: {
 var %file = ini\userips.ini, %sect = userips, %ii = $ini(%file,%sect,0), %x, %m, %i
  while (%i < %ii) {
    inc %i
    %x = $ini(%file,%sect,%i)
    if ($2 isin $readini(%file,%sect,%x)) {
      inc %m
      .msg $nick $2 has been matched %m times
    }
  }
}
Code edited for the variable and to have a clearer message displayed.