Taxing them to account for the externalities they bring.
This is notoriously problematic with oil and gas wells. When it's profitable, they're maintained and you get tax revenue. When they're not profitable, the company might just disappear and you're left with an abandoned uncapped well spewing pollution, generating zero tax revenue.