Hatfield’s Ferry Power Station, a Pennsylvania coal-fired power plant, stopped producing electricity in 2013. Its closure came in a wave of coal-plant shutdowns triggered by competition from cheaper, cleaner natural gas and incentives in the U.S. Clean Air Act.

But the facility’s legacy of smog pollution continued long after it closed.

That’s because a loophole in clean-air regulations allowed Hatfield’s Ferry to collect emissions allowances under a cap-and-trade program for five years after it shut down. The plant’s owner then sold those credits to other plants, which can use them to stay in compliance when they exceed their own regulatory budget of allowances. Among the beneficiaries: the biggest emitter of smog-causing gas in America’s power sector.