Liquidators for the Scottish Coal Company now face huge costs after they were told they could not walk away from several sites and use the money to pay off creditors.
RSPB Scotland welcomed the ruling, saying it was a landmark for environmental protection. However, it warned there was a £200 million shortfall in the amount set aside by coal firms to restore former mines because insurance policies intended to pay for restoration work might be "almost worthless".
The Scottish Coal Company had six working open-cast coal mines in East Ayrshire, Fife and South Lanarkshire and several others that were non-operational when it was put into liquidation in April. More than 600 jobs were lost.
Hargreaves Services, a Durham-based mining-to-logistics group, took over five of the working former Scottish Coal sites following an acquisition of assets from the liquidators for £8.4m.
The liquidators called for a long-term solution to the problem of clean-up costs, which were estimated at about £500,000 a month, while clearing the sites to comply with planning rules would cost another £73m.
In July, the Court Of Session accepted the liquidators' argument that the sites were too costly to maintain, using up cash which might otherwise go to creditors. But the Scottish Environment Protection Agency and the local authorities involved appealed the decision.
The new ruling of the appeals division of the Court Of Session reversed the previous decision, saying "a person cannot 'abandon' land, in such a way as to render it ownerless, and thus avoid any obligations which run with the land".
Joint liquidators Blair Nimmo and Gerard Friar had previously claimed money that might otherwise go to creditors of the failed company was being eaten up by the costs of maintaining sites still on SCC's books.
In July, the liquidators said that in 20 months no money would be left to maintain the five sites, which include Broken Cross, near Coalburn, South Lanarkshire, and House Of Water, near new Cumnock, East Ayrshire.
Mr Nimmo said a further appeal was being considered, adding: "The complexity of the issues raised in Scottish Coal's liquidation was unprecedented and we had no option but to seek the guidance of the Court Of Session to determine how to proceed. Unfortunately, the decision does nothing to solve the environmental damage left behind."
He said funds would continue to be used for care and maintenance of the sites but added: "However, in the context of the overall costs of restoration, these funds are simply a drop in the ocean."
Aedan Smith, head of planning and development at RSPB Scotland, welcomed the decision, adding: "It essentially says that polluting industries cannot come into Scotland, profit from trashing the environment, and then simply abandon the land when things go wrong, escaping from their responsibilities to clean up any damage caused to people and wildlife."