Do Governments pay royalties to companies for classified weapon projects?

Were pretty sure company inventions are being reverse enginnered & used in the military.