I cannot speak with legal authority, but I can show some precedents.
Once upon a time, actually, software developed under US Government funding was automatically public domain. I can cite several products that exploited that feature. Then again, back then universities were more into knowledge for the sake of knowledge and didn't try to monetize everything in sight. The richer we get, it seems, the poorer we act. I haven't heard specifics, but it certainly appears like a lot of government (taxpayer)-funded stuff ends up under private ownership these days.
On the other hand, there are many, many instances of Java code that are free to distribute, such as
Tomcat, Red Hat Hibernate, the various Apache libraries, and many, many more. They generally carry their own licenses, and assume that you have license for whatever Java run environment you are working in. At the moment, Oracle provides JDK and JVMs, IBM I think still does, and there's the open-source Java that's now common with Linux.
It's not just a case of whether you're free to distribute, though in government work. Commonly, the receiving government
unit has its own restrictions, which is where the "$25 hammer" trope comes from. Despite what some may think, the government does not answer to a single CEO who can say yea or nay on the use of a product, so instead specs are laid out in the attempt to ensure that taxes aren't wasted on inappropriate products. Even free ones. After all, a free webserver that dropped copies of daily Presidential briefings on Putin's desk every morning would not in any sane country be considered acceptable.