At least 12 people tunnelled into the mine in a mountainous region of West Java on Tuesday in the hope of finding gold and were buried when the shaft collapsed.
Local police spokesman Ita Puspitalena said the dead weren't miners but "looters" who did not have the expertise to dig in the mine, which stretches up to 200m underground.
"Without the proper support structures, it collapsed on them," she told AFP.
Local authorities had closed the mine in recent months but looting for gold in the mountains south of Jakarta is not uncommon, she added.
Also Read
Illegal gold mining has boomed in Indonesia in recent years as the price of the precious metal has surged, and deaths are common.
Eighteen people were killed after an illegal gold mine collapsed in west Borneo in October 2014.
In July the same year, a landslide killed nine men at yet another illegal gold mine in remote Papua province.