Only the most naive of libertarians deny that market failures exist. Externalities, information asymmetries, and public goods problems, in their various combinations, regularly lead to outcomes that fall well short of the blackboard economist’s Pareto-optimal perfect competition model.
That’s all very well established. What isn’t is the leap in logic that most people make next: therefore, government. Well, maybe. But maybe not. If the goal is efficiency, it becomes an empirical question. But most economists treat government as a black box without its own desires, goals, and behavioral quirks. Government actors are people, too. This means that government is subject to the same failures as markets. Harold Demsetz called the common assumption of perfect government the Nirvana Fallacy.
Geoffrey Brennan and James Buchanan, without using its name, perfectly describe the Nirvana Fallacy on p. 130 of their 1985 book The Reason of Rules:
There is no necessary presumption that simply because markets are imperfect, political processes will work better. On the contrary, as public-choice theory reminds us, there are very good reasons for doubting the capacity of political processes to achieve Pareto optimality. The normatively relevant comparison is between two imperfect institutions.
In fact, built-in incentive problems ranging from concentrated benefits and diffused costs to higher discount rates and shorter time horizons mean that government is usually more imperfect than markets. People seeking to improve on market outcomes who do not factor this into their analysis are unlikely to succeed.