Oh, but the statute defined firearm to include bb guns. The court was only carrying out the letter of the law. The court would be failing in its duty if it did otherwise.
You're right; I misread the story. The legislators are wrong to change the definition of firearms instead of changing the laws that restrict firearms for prohibited persons, but the judge was correct to apply this poorly-written law as he did.
In EXACTLY the same way an escaped slave must be returned to the rightful owner, even if he is captured in a state that does not allow slavery. The court was only carrying out the letter of the law. The court would be failing in its duty if it did otherwise.