That's what federal funding for universities looks like.
I remember that people advocated quite hard a few years ago to make that last part mandatory, because at the time it wasn't. Universities can claim ownership and patent the discovery. The research was also usually locked behind for-profit publications, thus limiting the research to only those that can afford to pay.
The initiative that I remember asked that government funded research must be published in open access, and that no patents (or other IP) may be created in direct relation to such research.
Did such initiative win and become law?
Regardless, researchers share their research with other researchers for free and a huge amount of paywalled papers are actually just available for free on the authors' websites.
It's investment, not charity.
For example:
| Sarah Fortune, a professor and chair of the department of immunology and infectious diseases at Harvard T.H. Chan School of Public Health, woke up Tuesday to a stop-work order for a large contract focused on unraveling how the immune system fights tuberculosis, with the goal of creating better detection and vaccines.
Who said they aren't profitable