I'm not sure if this is sarcastic, but there quite literally is not a "free market based mechanism" to do this. If there were, there would not be the market failure that we can observe today.
There are plenty of market-based methods for accounting for these externalities though, such as Pigovian taxes.