This debate comes down to assessing why we have a criminal justice system. Is it to deter crime, or to administer punishment, or exact revenge, or to rehabilitate people, or a combination of all of those? Which of those purposes does the continued incarceration of a dying inmate satisfy?
Probably a combination of all those things.
"I got news for you. If it wasn't for the toilet, there would be no books." --- George Costanza.