Here’s a clear explanation of the rationale for regulating or taxing external costs:
Environmental regulation addresses a particularly striking example of market failure. Markets are generally efficient if companies’ revenues correctly reflect all the benefits that their output bestows on third parties, while their costs reflect all the harms. In this case, maximizing profit leads to maximizing social welfare.
But if production entails environmental damage for which companies do not pay, incentives are distorted; companies may turn a profit, but they function inefficiently in economic terms. So the state “corrects” firms’ incentives by levying fines or issuing bans.
I find this elegant as long as the external costs are relatively small compared to the costs that are reflected in the market. However, what if the costs priced by the market represent only a small fraction of the total cost. Then the idea of taxing the external cost wouldn’t work.