Disclaimer: The article linked is from a single source with a single perspective. Make sure to cross-check information against multiple sources to get a comprehensive view on the situation.
I'm talking more about serial killers, serial rapists, repeat violent offenders etc. who do not respond to rehabilitation after ample opportunities. Death penalty cannot be more expensive than incarcerating people for decades. All that you need for capital punishment is a tough piece of rope and gravity. But if you want to use more humane methods, voluntary euthanasia costs in Switzerland are about $13k, which is far less than housing someone in a maximum security prison for even one year.