Jails and prisons are signing up inmates for health insurance under the Affordable Care Act (ACA), according to The New York Times.

Inmates enrolled in Medicaid while incarcerated can have coverage after they get out. People released from jail or prison have much higher rates of addictive disorders and mental illness, compared with the general population, the article notes. Few of them have insurance. In the 25 states that have elected to expand their Medicaid program, many inmates would qualify for coverage under the income test—138 percent of the poverty line.

Medicaid does not cover standard health care for inmates while they are incarcerated, but it can pay for their hospital stays beyond 24 hours. This means states can transfer millions of dollars in obligations to the federal government.

Up to 35 percent of people newly eligible for Medicaid under the ACA have a history of involvement in the criminal justice system, including those currently in jail or prison, and those on probation or parole.

A study published last week concludes the ACA could give an estimated 4 million people who have spent time in U.S. jails better access to health care, including coverage for treating substance abuse and mental illness.

While the law does not change health care access for people while they are in jail, it does improve the chance they will receive health coverage before and after they are in jail, the researchers said. They noted this could reduce the chance they will end up being reincarcerated.

Cook County Jail in Chicago has submitted more than 4,000 applications for Medicaid enrollment for inmates since January 1. More than 1,200 inmates in the Portland, Oregon area have been enrolled through the state exchange.