Two people were assigned to each grave, with one digging the grave and the other laying wooden boards inside to support the corpse.
"There are only three available gravediggers at the moment so I thought I might as well put these people to work with them," Suyono told Tribun News.
"Hopefully this can create a deterrent effect against violations."
The rule-breakers were not made to touch the corpses - a task which was left to local health officials wearing full-body personal protect equipment.
Mask-wearing became mandatory in Indonesia on 5 April, and officially became legislated in July.
President Joko Widodo declared a public health emergency on 31 March.
Digging graves is not the only unusual punishment some Indonesians have been dealt. Last week, police forced mask violators to sit in a hearse containing a casket, where they were asked to reflect on their actions.
Vendors who broke the rules have also had their shops temporarily closed, their IDs confiscated and have been made to clean open sewers as punishment, law enforcement co-ordinator Ugas Irwanto said.
Indonesia has reported over 218,000 cases of COVID-19 since the pandemic began, as well as 8,723 deaths, according to figures from Johns Hopkins University. It has the highest death toll in Southeast Asia.
People in Australia must stay at least 1.5 metres away from others. Check your state’s restrictions on gathering limits.
If you are experiencing cold or flu symptoms, stay home and arrange a test by calling your doctor or contact the Coronavirus Health Information Hotline on 1800 020 080.
News and information is available in 63 languages at sbs.com.au/coronavirus