To get a patent, you have to give detailed drawings and intricate details describing how and why something is new and works. Then it becomes public knowledge.
UNLESS the government classifies it...in which case it either does NOT become public knowledge or not until the tech is independently invented or revealed by another party. In which case the classified patent has date priority.
The feds can intercept the patent or even the prepatent steps before it becomes public and throw it behind a classified, very black curtain. The patent owner, if the feds choose so, will not even know what the feds are or are not using the patent for. As the patent owner, they will be paid royalties.
A company I worked for had a unique product for its time, that had a ridiculously fast microprocessor. Basically, we were about 20 years ahead of IBM and AMD hadn't even been born yet. It was equally expensive.
The corporate strategies were 1) to not patent and instead go proprietary and 2) to never sell our products to a federal agency of any country.
Our microprocessor and ROM were encased in an epoxy block plus I think had some self destruct electrical provisions as well. Basically, the idea was if anyone tried extract the microprocessor/ROM or tamper with them they would just have a useless piece of semiconductor that could not be reverse engineered or decoded. It worked.
I've filed a number of patent disclosures over the years. No patent applications were filed however. In some cases, the corporate patent lawyers declined to pursue a filing and in others the corporation decided that its best interests were served by keeping the info confidential.
Good point.