Jakarta has won its battle to extract extra tax revenue from foreign mining companies. After eight acrimonious months during which mines suspended operation, Freeport-McMoran FCX -0.31% and Newmont have both agreed to pay a 7.5% levy on mineral exports. At least now production can resume, thousands of laid-off workers can return to work, and Indonesia can begin recouping billions in lost revenue. But the government's shakedown will deter future investment, and not merely in mining.
Freeport and Newmont had long-term contracts with the Indonesian government that guaranteed their investments a stable regulatory environment free from political expropriation. It turned out they were worthless.
When Jakarta announced a 20% export duty in January that would rise to 60% by 2016, both firms invoked their contracts, halted exports and asked the government to reconsider. Newmont pushed especially hard, declaring force majeure at its Batu Hijau mine in June and initiating international arbitration a month later.
The government responded in full nationalist dudgeon. President Susilo Bambang Yudhoyono condemned Newmont for having "undermined the sense of justice of the Indonesian people" and for failing to value "Indonesian soil, the birthplace of Indonesia's ancestors." Jakarta threatened to rescind Newmont's mining license.

The threats worked. Freeport caved in July, perhaps reckoning that it couldn't stand to lose its Grasberg mine in Papua province, which accounted for about 20% of its revenue last year. Newmont followed last week. The companies did manage to bargain Jakarta down to a 7.5% rate plus higher royalties. But now that their contracts have been violated once, they can have little confidence that this deal won't also unravel.
The firms further agreed to begin financing the construction of smelters for processing raw ores into metals—$25 million from Newmont, $115 million from Freeport. Smelting inside Indonesia is largely uneconomical because the geography is unsuitable, the infrastructure is poor and there is excess smelting capacity overseas. But Jakarta wants to develop its minerals industry for political reasons, never mind the misallocation of resources.
While officials in Jakarta celebrate these deals, foreign investors have more reason to avoid Indonesia. It doesn't help that the official responsible for mining policy, Energy Minister Jero Wacik, was forced to resign last week after being named a suspect in an investigation by the Corruption Eradication Commission.
Another red flag: Jakarta has promised to cancel some 67 bilateral investment treaties with countries including Germany, Britain, France, the Netherlands, Australia, Singapore and China. The government considers the treaties unfair because they include dispute settlement mechanisms that allow foreign firms such as Newmont to seek international arbitration if Indonesia threatens to expropriate assets.
Oil and gas firms are likely paying particular attention. Indonesia badly needs new energy investment as import costs rise and domestic oil production falls toward 800,000 barrels per day from one million in 2010.
All of which underscores the challenges that face Joko Widodo when he is sworn in as President on Oct. 20. Markets cheered when he won election this summer because as a former entrepreneur he at least understands the risk-reward calculus of business.
Yet Mr. Widodo also has a nationalist side, and he has supported the government's squeeze on foreign miners. Respecting contracts is in the country's long-term interest, but it is a rare Indonesian politician who can resist the temptation of populism.