The government still needs to raise money for e.g. funding the roads. This is not, because the government wouldn't be able to direct the resources of the economy towards this goal otherwise, but because the costs of that goal should be part of the beneficiaries of that goal. This should prevent inefficient pursue of goals.
For example when you get too less money for roads, it can be because all the foreigners use it for transit, but don't actually fund it, meaning the government subsidizes another governments economy, or because too less people drive on your roads/ people don't care much for the roads, so maybe you are building too much of them. When on the other hand you have to much money for roads, then maybe you are not building enough roads.
However this is not the only measure, as roads also create induced demand/economic activities, i.e. you need to put up roads to foster specific activities, before you see the demand. In other words it's complicated and you need to be an expert in the field you are governing and governing itself.
But while money on its own is (nearly) free for a government, once you have handed it out it isn't free anymore, since it now represents resources, that are also restricted for the government. This means that it still makes sense to be frugal with money, just not for money that was just created by it, but with money that comes to the government for the second time, and is now to be spent again, since this already is a proxy for specific resources.
> governments often act and talk like like their goal is to maximize revenue
I think this often comes from business people who promote (themselves) to government, but don't got the memo, that they aren't working for a company anymore, but instead decide on the framework for companies to thrive or not.
Politics, literally the art to govern [a city], is really the art of creating hard rules that still don't prescribe anything but instead control the famous invisible hand of a free market towards the right behaviour.