They could have used the act's own words, which specifically exempted the military from the regulations about short barreled rifles and shotguns. The military can have all the short barreled shotguns it wants. Law enforcement was also exempt, and police assume a paramilitary role in times of emergency. It was illogical for the court to refuse to see that "use of a 'shotgun having a barrel of less than eighteen inches in length' at this time has some reasonable relationship to the preservation or efficiency of a well regulated militia . . ." when the law was written so that only military and paramilitary organizations could have them.
The military was exempted from the tax, yes. What about the state Militia? Was a Militia member exempt when he went to purchase such a weapon? If "we the people" are the Militia, then ....