Prisoners serving time in an Oklahoma penitentiary have written software to monitor the institution's canteen that could save the state $20m a year – and which has raised some awkward questions for one of the prison's outside suppliers.

Two criminals in the Joseph Harp Correctional Center – one doing time for murder and another for sex offenses – wrote some code that monitors operations in the big house's kitchens. Each prisoner in the facility is issued a barcode and the software checks that no one takes extra meals or checks out kitchen equipment and doesn't return it.

"It's a pretty neat program. It's all done by the direction of the supervisor, one of these guys who's kind of, what do you call it, thinking outside the box," Bobby Cleveland, an Oklahoma state representative, told the Washington Post. Cleveland estimated the software was so good it could save the state millions if used in other jails.

The application not only saves money by making the kitchens run more smoothly, but also by avoiding legal bills. Prisoners who have the right to a diabetic, vegetarian, or religiously mandated meal (such as kosher or halal food) have successfully sued the state for non-compliance, but the new software ensures everyone gets fed the right thing.

But the code also monitors what food comes into the facility and the banged-up developers found that Sysco, the contractor that supplies the state's facilities, was charging different prisons different prices for the same products.

"It does kind of expose the waste at all the other facilities. It was just one of those genuine, lightning-strikes things," said Oklahoma state representative Jason Murphey. "You're always dependent upon those at the ground level to report what's going on. Here in this facility, you had those employees at the ground level taking their jobs very seriously."

Sysco denied any wrongdoing to reporters, adding that the price differential may be due to the differing times at which orders were placed. Prices for its products fluctuate weekly to reflect demand and the quality of grub, the company said.

Getting prisoners to write software for their own facility did raise eyebrows, however. The two inmates worked with a member at staff to knock out the code, and the software is independently audited to make sure that they haven't slipped in any backdoors or tried to game their own program. ®