Budgets are finite, but currently, the state leaves both money and economic legibility on the table. The simple system should be: if you build and commercialize technology based on a public research grant, the state owns the patent and can set a fixed licensing rate proportional to the amount of the original grant funding. The state then splits the royalties, with you the developer taking most of them, but some large portion poured back into public research budgets (including from money you make off the patent). As your patent term expires, it begins costing you progressively larger portions of royalties and revenues to renew it.
Eventually, the knowledge you documented to get the patent becomes public domain, or the state basically takes all the revenue from renewed patents.
This doesn't just make money for the public research system, it guarantees legible terms to prospective licensees and rules out patent trolling wholesale.