The Eighth Amendment to the Constitution clearly prohibits cruel and unusual punishment. But what it doesn’t clearly do is describe what punishments, exactly, are cruel and unusual. That’s been left up to the courts.
And while one could argue that ending a person’s life is the cruelest thing the criminal justice system could do, courts have allowed the death penalty to exist while outlawing some lesser punishments.