Methadone was not a new thing for Mr. Mason, 43. He had been on it before he went to jail for cashing forged checks. But it is almost always banned in jail, increasing the chances of relapse. Of the nation’s 5,100 jails and prisons, fewer than 30, according to the federal Bureau of Justice Assistance, offer opioid users the most proven method of recovery: administering methadone or buprenorphine.

Mr. Mason, though, had been allowed to take his daily dose, in a fledgling program that helped him continue what he says has been his longest period off heroin since his teens.

“It is the key to my success,” he said. “It did what it was supposed to do. It kept me clean.”

For more than a year, the PBS series “Frontline” and The New York Times followed 10 newly released prisoners in Connecticut, including Mr. Mason, as they tried to start over. Though the stories were about the criminal justice system, they were also, inevitably, about addiction — three out of four inmates in Connecticut have a drug or alcohol problem, according to the Department of Correction, and the number who use opioids has soared.