At times markets are fascinating and extraordinary things. Like you can move to Perth and expect to find another family over there with a house that they are willing to sell. The historian points out that market economies have developed over a long period of time, and spectacularly out-performed communist command economies during the middle decades of the 20th century.
To be sure, we learned how economists allow for circumstances they call market failure. These include market power, merit goods, public goods and externalities. Market power is monopolies and oligopolies that distort the market. Public goods are ones like street lighting that can be subject to the "free rider" syndrome, where essentially everyone benefits and if people opt out they can get it for free. Merit goods are things like water and health care, where delivery is most economically effected by everyone chipping in. Externalities are ones like pollution, where the cost of pollution is not being charged to the polluters. In these cases, the market advocates recommend adjusting the "property rights" to cover this. So they recommend systems like the emissions trading scheme, under which polluters must pay for the damage they are doing done through global warming.
However, economists tended to take the market into the realm of dogma. The argument was that a private firm would always out-perform a non-profit, because of the discipline of the market. This led to a number of interesting case studies which tended to disprove this thesis. To the scientific mind, a single counter example does serious damage to a theory; if there are many, then the theory is demolished. So the doctrine of the inherent efficiency of the market is counter-factual. And it is not just a matter of market failure always being present to some degree. The simple fact is that some companies are just badly run and deserve to disappear but the dogma holds that this cannot happen.