But since 997 is prime, wouldn't Lagrange's theorem apply to show that there are ONLY 2 solutions?
What has Lagrange to do here? Since 997 is a prime there are only two solutions because any polynomial p(x) ( e.g., $\displaystyle x^2-25=0$ ) over a field can have at most $\displaystyle \deg(p(x))$ different roots in some extension of the field.