And in fact, there are laws against pollution because it's an externality, it doesn't make economic sense to the whole of society. Markets are good at maximising the total good in the case where costs and benefits can be totally internalised. Where you have externalities you see either overprovisioning or underprovisioning and in net, everyone is worse off than the rational outcome. That's where intervention is better than a market by itself.