Santos Bernard's family has a little farm in Cibao, a fertile region in the north of the Dominican Republic that produces arguably the best cacao in all of Latin America. When he was growing up, he would take the cacao pods from the trees, split them open and eat the soft, white seeds (it's during the drying process that they turn that rich, nutty brown). So it must be his destiny, Santos thinks, that he has wound up working in a chocolate factory called Dolci Libertà on the industrial edges of Milan. "It's good chocolate," he says, with a connoisseur's certainty – and two gold awards and a silver from the 2013 International Chocolate Awards back him up.

The 37-year-old's journey has been complicated. Santos lived in New York City for a few years, met his wife, had three children and moved back to the Dominican Republic. Then a business opportunity presented itself in Italy that he felt he couldn't turn down. At this point his life took a turn. In October 2011, he was pulled aside at Milan's Malpensa airport and his bags filleted by customs officials. They found four kilos of cocaine with a street value of just under €200,000. Next stop for Santos was Busto Arsizio prison on a four-and-a-half-year sentence. "Only been to the airport and here," says Santos, who is wearing white overalls and a hairnet. "They're the only places I know in Italy."

Photograph: Murdo MacLeod

We are standing in a light, medicinally clean and modern room that does not look much like a prison – so long as you forget the five-metre fence and rigorous security you have passed through to get here, plus the lurking presence of guards in smart, brass-buttoned uniforms. It used to be the gymnasium, but on 4 October 2010, it reopened as a state-of-the-art chocolate factory. The space is full of stainless-steel Selmi machines for coating and tempering, the best that money can buy. Apparently there's no other artisanal facility like this in Italy. Dolci Libertà ("Sweet Liberty") is run by a private company but the work is overwhelmingly done by two dozen drug mules, armed robbers and at least one murderer. Each of them is paid a monthly wage of €400-600.

The idea of rehabilitating inmates through work is not a new one and there is cross-party consensus in the UK on its importance. The average rate for re-offending in this country has been estimated by some research at 61% but that has been shown to drop by significantly when prisoners learn a skill or a new trade. According to a 2011 report for the Department of Justice, the economic costs of re-offending are as much as £13 billion every year, so it is easy to understand why David Cameron talks about the need for a "rehabilitation revolution".

Food has been seen as a therapeutic activity for these schemes. Gordon Ramsay set up Bad Boys' Bakery with 12 prisoners in Brixton prison and last summer their lemon treacle slices were sold in 11 branches of Caffè Nero in south London. More enduringly, the Clink charity has set up ambitious restaurants in High Down prison, Surrey, and HMP Cardiff. Around 85 prisoners have been trained as chefs and waiters since 2010, and 25 have found full-time employment on release.

The need to free up space in prisons and reduce costs is even greater in Italy. In 2010, Silvio Berlusconi's coalition government declared a state of emergency on the issue when it was revealed that 65,000 inmates were stuffed into jails designed to hold two-thirds of that number. (Berlusconi might add to that total personally, after receiving a four-year sentence for tax fraud in October. "He should be one of the chocolate makers soon," says one wag on my visit, but no one believes he won't find a way to wriggle out of it.)

Photograph: Murdo MacLeod

In 2010, prisoners at Busto Arsizio complained of being "kept like battery hens" to the European Court of Human Rights in Strasbourg. A medium-security facility built in 1984 to detain 180 inmates, it now had 450. Not long afterwards, Dolci Libertà moved in. In Italy, prisoners have been used for years to staff call centres, make furniture and, at the notorious high-security Opera jail in Milan, churn "experimental, artisan" gelato from local ingredients. But this was the first chocolate project, and the governor of Busto Arsizio, Orazio Sorrentini, believes it's a natural fit.

"The products are sweet, so their souls become sweet, too," says Sorrentini, a dapper anglophile who prefers talking about Chaucer to discussing incarceration. "Italy is famous all over the world as a country that loves food. The British had an empire. The Romans once had an empire, but now we have food."

Santos does not know why he was selected to work in the chocolate shop ("It's like a lottery"), but he can recall the moment almost to the minute. "I've worked here one month and five days," he says, smiling broadly. "Before I spent 21 hours a day in a cell just watching TV in a bed. Now time goes fast! I've got one year left of my sentence but, working here, it's like tomorrow. I'm even mad now because we have a vacation over Christmas. I want to work because those 10 days in a cell are like two months."

Andrea Gacelli is a rare thing in Busto Arsizio: an Italian. Almost 60% of prisoners are foreign; an incongruous statistic explained by the fact that it is the closest prison to Malpensa, a hub for flights from Central and South America. Andrea arrived from Jamaica with half a kilo of cocaine in his stomach that was detected by an X-ray. In the past, the airport was viewed as an easy gateway for drug traffickers, but in recent years the Italian police have got their act together. "People told me Malpensa was good, everyone was going through," says Santos. "But now they've put a new guy there, an intelligent guy, he's like James Bond. He gets everything."

The prisoners may not realise it, but there are selection criteria for working at Dolci Libertà: because of the two-month training period, inmates must have at least two years left to serve; the prison also rewards the best-behaved inmates. "There are no fights ever," says Andrea, of working on the production line. "You have to be good, because if you make a mess they don't let you go out or they send you to another job. So all of us are friends." Despite the availability of knives, alcohol and other temptations, only one prisoner has been "fired" in more than two years.

According to their three external supervisors (all long-standing chocolate experts), the men work diligently and with some dexterity. They are certainly creating exceptional products using fine ingredients, including couverture from Domori and Valrhona, two of the world's most distinguished producers. Dolci Libertà's dark chocolate truffle infused with nucillo é curti, a liqueur made from walnuts harvested on the slopes of Vesuvius, wowed the judges from the International Chocolate Awards, while their milk chocolate pralines are sweet, salty heaven. The prices are competitive, too, starting at around £3.50 for a small bag of truffles.

Photograph: Murdo MacLeod

Sales started cautiously but are picking up, helped perhaps by a loose affiliation with some AC Milan footballers. "A couple of people said, 'We don't want to introduce your product because if something happens or the parents give it to their kids and they don't enjoy it …" says Dionigi Colombo, the founder of Dolci Libertà, who has a family link with Milan and persuaded one of the club's greats, Franco Baresi, to attend the launch in prison. "But we try to demonstrate that first it's about the product and then I tell you where it's made. Or it is like giving money to a social project, but you have something real in your hands."

Colombo hopes that if demand continues to grow, he can introduce more prisoners to the factory. Ultimately, he believes that the operation could work round the clock in three shifts of eight hours, employing 60 staff. The inmates would certainly be keen: alternative jobs, such as cleaning or working in the food hall, only pay around €190 a month.

Santos and Andrea clearly enjoy their shifts, but it is impossible to tell whether that is because they love working with chocolate or because they can earn well and it also allows them access to a proper toilet rather than the hole in the floor in their cramped, overcrowded cells. It's a long shot to imagine them as chocolatiers on the outside.

But one employee who wants to do exactly that is José Luis, a 38-year-old from Santa Cruz, Bolivia. He is serving eight years for drug trafficking and has worked at Dolci Libertà since the project started in 2010. Initially he put chocolates in boxes and sealed them, but slowly he has progressed so that last Christmas he was one of three workers entrusted to make panettone. From October onwards, he was mixing, shaping and baking 200 loaves every day. He has hatched a plan with his cellmates – a Brazilian and a Portuguese – to open a pastry shop together in Brazil when they are all released.

"I've had this skill inside of me for years without knowing it," José Luis says, eyes wide. "There's a saying in Italian: 'In life, the most important thing is not to reach from one to five, but to reach from zero to one.' When I was caught at Malpensa, I felt like I was in a deep hole and I'd stay in that hole forever. But now, every day I'm taking another step up on the ladder."