SILICON VALLEY mavens seldom stumble into San Quentin, a notorious Californian prison. But when Chris Redlitz, a venture capitalist, visited seven years ago, he found that many of the inmates were keen and savvy businessmen. The trip spurred him to create The Last Mile, a charity that teaches San Quentin inmates how to start businesses and code websites, for which they can earn up to $17 an hour. One of the first people it helped was Tulio Cardozo, who served a five-year sentence after a botched attempt at cooking hashish, which also left him with severe burns across half his body. Two years after he was released, he got a job as a lead developer in a San Francisco startup.

Such redemptive stories are the model for what the prison system could be. But they are exceptions—the rule is much drearier. Prison labour is legally required in America. Most convicted inmates either work for nothing or for pennies at menial tasks that seem unlikely to boost their job prospects. At the federal level, the Bureau of Prisons operates a programme known as Federal Prison Industries that pays inmates roughly $0.90 an hour to produce everything from mattresses, spectacles,road signs and body armour for other government agencies, earning $500m in sales in fiscal 2016. Prisoners have produced official seals for the Department of Defence and Department of State, a bureau spokesman confirmed. In many prisons, the hourly wage is less than the cost of a chocolate bar at the commissary, yet the waiting list remains long—the programme still pays much more than the $0.12-0.40 earned for an hour of kitchen work.

Similar schemes exist at the state level as well, making the market of 61,000 captive labourers worth well over $1bn. California’s programme expects to generate $232m in sales this year, much of it from construction and textiles, though $10m is also expected from meat-cutting. In Idaho, prisoners roast potatoes. In Kentucky, they sell $1m worth of cattle.

Critics have spent years directing their anger towards private prisons, by pointing out the moral hazard created when profiting from punishment. Jeff Sessions, the attorney-general, caused a stir last month when he cancelled an Obama-era directive to phase out federal contracting with private prison companies, which expect bumper earnings under Donald Trump. The share price for CoreCivic, the rebranded name of the Corrections Corporation of America, shot up by 43% in a single day after Mr Trump was elected, in anticipation of lucrative contracts to run immigration detention centres.

But those who attack the new prison-industrial complex might be surprised to learn that America’s publicly run prisons have been providing labour for private companies since 1979. More than 5,000 inmates take part in the scheme, known as “Prison Industry Enhancement”. “Orange is the New Black”, a television show set in a women’s prison, recently lampooned a private-prison takeover, after which the inmates are forced to sew lingerie for $1 an hour. But this gets the history only half right. Female inmates did indeed make lingerie for brands like Victoria’s Secret in the 1990s—but only through a deal between South Carolina’s public prisons and a private manufacturer.

America’s prison-labour industry is wrapped in euphemism. Federal Prison Industries does business under the more palatable name of UNICOR, and government-run prison production schemes are called “correctional industries”. Some slogans are better than others; UNICOR has an unfortunate habit of calling its facilities “factories with fences” in reports.

Employment upon release is perhaps the best defence against recidivism. The chief justification for prison labour is that it both defeats idleness and gives inmates marketable skills. Whether it actually does so is unclear. “The vast majority of prison labour is not even cloaked in the idea of rehabilitation,” says Heather Thompson of the University of Michigan. Simple manufacturing jobs, like the ones done cheaply by most inmates, have already left the country. The study pushed by the Bureau of Prisons, showing drops in reoffending, was published in 1996. More recent comparison statistics often ignore bias in how those being studied are chosen. Rigorous academic work on the subject is almost non-existent.

Still, such programmes are undoubtedly legal. The Thirteenth Amendment to the constitution prohibits slavery and indentured servitude—“except as a punishment for crime”.