Some people incarcerated in Pennsylvania state prisons are as far as one could imagine from being a threat to society. They can barely take care of themselves, let alone hurt others — and some are terminally ill. The need to care for these people is so great that last year, the Department of Corrections announced a new unit, a first of its kind, specifically to treat those who are imprisoned and suffer from dementia. The unit is in addition to existing long-term care beds, which also provide hospice care.

» READ MORE: Broken ‘compassionate release’ rules strand Pa.’s sickest prisoners as costs to taxpayers soar

What does Pennsylvania gain from incarcerating a person with dementia? The obvious answer is nothing. But broken laws, harsh sentences, and a lack of political will mean that there is no way out of prison, no matter how ill or frail one becomes.

The Pennsylvania state prison population is getting older. The Department of Corrections defines an “elderly inmate” as being over 50. A decade ago, this age group accounted for roughly 10% of those in state prisons; now it is 27%. Among those roughly 10,000 individuals who are designated “elderly” behind bars, nearly 2,000 are over age 55 and have already served at least 25 years — and the vast majority are serving life without the possibility of parole. It will take something close to a miracle for them to die anywhere else but in prison.

Pennsylvania has a “compassionate release” law, sort of. The measure allows people who meet extremely strict criteria to be transferred from prison to a hospital, long-term care facility, or hospice. To be granted compassionate release under current law, individuals need to prove, among other things, that they are so ill that their death is imminent and they need care that is better provided outside of the prison. In practice, according to a recent investigation by SpotlightPA, 31 people were granted compassionate release in the last 13 years.

The cost to the state is huge. The average price tag per person for medication alone for an incarcerated individual over the age of 50 is nearly $3,000 a year. That’s double the cost for those under 50. Last year, the State Correctional Institutions in Laurel Highlands and Waymart, where individuals requiring long-term care are imprisoned, accounted for 9% of the entire prisons operations budget — $204 million. That’s despite the two facilities accounting for only 5% of the state prison system’s capacity.

Besides compassionate release, the only other way out of prison for a person serving life without parole is a commutation. Gov. Tom Wolf has signed the most commutations of any governor since the 1970s. But that has resulted in a grand total of 45 life sentences shortened — even though about 1,000 people serving life sentences in Pennsylvania never took a life. And those releases hardly ever have a negative effect on public safety: Study after study shows the lifers whose sentences were commuted or were pardoned rarely go on to commit other crimes.

One possible release valve for the system could come in the form of a medical parole bill introduced by State Sen. Sharif Street, a Democrat from Philadelphia. Street’s proposal would replace the state’s stringent compassionate release law with a system that allows for consideration of parole based on age, health, and length of time in prison. Another bill, introduced by State Reps. Joanna E. McClinton and Stephen Kinsey, both Democrats from Philadelphia, would allow for a commutation of a life sentence with a majority vote of the Board of Pardons instead of unanimous approval.

» READ MORE: Pennsylvania’s broken ‘compassionate release’ law, by the numbers

Pennsylvania could also do more to help people behind bars to remain healthy. Last year, John Wetzel, then the state’s secretary of corrections, suspended medical co-pays indefinitely. Wetzel left his post last fall, and shortly afterward, acting Secretary George Little lifted the suspension, with exceptions for chronic care and other scenarios. It might seem like not much, but $5 in a prison where an hour of work is compensated with a starting wage of 19 cents per hour can be a small fortune. A bill introduced by State Rep. Amen Brown would end the practice of medical co-pays in prison if passed and signed into law.

The costs are staggering, the public safety benefits are minimal, and the human toll of incarcerating the elderly and infirm is not one the state should have on its conscience. That is the story of Pennsylvania’s aging prison population — but it is one that state officials can change by choosing compassion over complacency.