It's the best of times, it's the worst of times. At least when it comes to mining coal.

After years of decline, demand for the polluting fossil fuel has surged this year as Europe scrambles to replace Russian gas, and coal miners are making money hand over fist.

With coal prices hitting record highs, companies would normally expand their operations, but projects are being left on the table as most Western banks stand by climate pledges to restrict lending to the sector, according to a dozen mining company executives and investors.