Because of double jeopardy. The question isn't whether the judge rules, it's whether the government can appeal the ruling.
If the judge grants the motion before the jury decides, that counts as an acquittal. The Double Jeopardy Clause bars an appeal and a retrial, even if the judge got the law badl...