There is a huge difference between software created for the government and software the government uses.
I agree 100% that when the government creates a contract for new software to be written, the government (the public) owns that code and it should be open source.
But if the government uses existing products and services, such as macOS, I think it is wrong to say that the public now owns macOS and that apple must open source their code.
Similarly, is NASA contracts spaceX to design and test a new rocket, then that new rocket arguably belongs to the public and should be open source. But it is wrong to claim that the public now owns everything SpaceX might produce, such as video content, just because SpaceX took on a government agency as a customer.
Yes. Public money, public code. https://publiccode.eu/