Isn’t it obvious?
Instead of having government rely on tech companies, it should just build its own solutions.
And those solutions would be open source and use open source dependencies.
It would then have a budget to donate to different projects given that it saves time by using other foss software.