If the government buys Mercedes cars it doesn't demand Mercedes to hand over the engineering designs for the cars.
In fact in the entire military and intelligence space I don't even think this is practically possible due to secrecy and avoiding to give away software that is vital to national security.
Another obviously giant issue is that this would effectively prohibit companies which do proprietary work in the private sector to work with the government at the same time, because they'd be forced to open source their code. The likely result of this would simply be that the government has significantly less software to chose from, higher cost, or needs to start maintaining large engineering teams to replicate entire software stacks just for public use.