When it comes to the economy, governments set economic rules known as regulations, collect taxes, and spend money. The idea is that they use public funds to provide services that anyone and everyone should have equal access to, and set the rules of the game for everything else—i.e. private services —to happen in a fair way.
By setting rules and regulations, governments create the framework in which markets operate. Mostly we think of regulations as governments telling us what not to do—don’t pay an employee less than minimum wage, don’t pour toxins in a river, don’t sell spoiled food. But governments can also regulate the economy in more behind-the-scenes ways, like establishing property rights, issuing money, and regulating the stock market.
It’s not just setting the rules, though; governments get involved in the game too. Depending on the country, governments tax people, goods, and services in different ways, and spend what they collect on public services. Sometimes they’ll pay a private contractor to carry out a service, as often happens in the military; other times, they’ll run the sector entirely on their own funds and employees, as sometimes happens with education or healthcare.
The unanswerable question of economics is what should be run by governments, and what shouldn’t. Some say that the government’s only role is to protect people’s property and freedom, providing the space for voluntary transactions between countless individuals to happen. Others say that’s not enough; when we say ‘the market’, we really just mean society, and society is full of inequalities and injustices (racism, sexism, xenophobia) that won’t be corrected without some sort of top-down policy intervention.
There’s no right answer; each of us has got to work out what we think based on our own values and experiences.