If you’re not going to take the effort type “can a government use patents” into Google and look at the top link. It took me less than a minute to find that government using a patent is just baked into the patent system. There’s not additional law around it. So it might be better to go the WD 40 route and never actually file a patent to the formula to avoid sharing the formula publicly.
Terrorism is actually a pretty simple but specific definition. Terrorists use unlawful violence and threats of violence to influence the government or an international governmental organisation, or to intimidate the public. They do this in pursuit of a political, religious, racial or ideological cause.
It doesn’t take much money or many resources to engage in violence or even make threats. Certainly having money and resources at your disposal make you more effective but it’s a rather low but still specific bar to cross to be considered a terrorist.