What gets me, is that this has been known "forever", aslong as there's been a solid theory of capitalism, atleast.
The solution, of course, is to set a fair price on the externalities. What that price is, and how to practically evaluate, collect and distribute that money, is a difficult problem, however notice that even if the money is collected in a highly inefficient manner, it is still frequently better than the alternative.
If you want to do something that gains you $50M while costing every human being $0.05 - then the overall loss is $300M. If there was a tax on your pollution to the tune of $250M, then you'd conclude it's not worth it since the taxes are higher than your gains.
In this case, no taxes are collected, and no deal is made - but nevertheless the tax-code was useful: it prevented $300M worth of harm from taking place.
Notice that even mostly-squandered taxes is a win from the perspective of everyone-but-you.
Let's say instead you want to do something that gains you $100M, while costing the rest of humanity $25M. We tax your activity at $50M, and the inefficiency of bureacracy means half of the collected taxes are completely wasted.
End result: With the tax you gain $50M and everyone else breaks even. Without the tax, you gain $100M, and everyone else is down $25M. -- thus the tax, despite being 50% wasteful, is a net-gain for everyone except you.