I believe people need to get a chance to change themselves and even mentally challenged person should get medical help to recover.
And prison are not a great way to make them better person and is very costly.
I believe prisoners should be indulged to labour works and social works under proper supervision.
What about the serial killers? The mass murderers? Do they deserve the same treatment as well? If they all use mental illness as the reason for their crime, it will be a shame to people who are truly suffering from it. Sometimes, a person who has done a terrible crime deserves to be sentenced to death. But as for alternative to death penalty ideas, the only thing I can think of is to have them experience what their victims experienced. For example, have a rapist be screwed over and over and over by a pig or a horse. Or starve them off. Lock them in a padded cell with a noise barrier while limiting their food and drink supplies.