The death penalty does, indeed, exist within the DC and Marvel comic universes. Typically, however, it is not employed against supervillains. There are many in-universe reasons, but the out-of-universe reasons are twofold: many comics don't involve a lot of death and if they kill off a supervillain they can't use him again (without an elaborate explanation of how he's alive or how the mantle changed hands).
Those are the out-of-universe reasons. In-universe, the reasons are more varied.
- The villain doesn't warrant it.
There's a huge number of supervillains who just don't deserve the death penalty (which is really hard to be given unless you're convicted of some very bad crimes, in real life). Calendar King, Scorpion, Captain Boomerang, etc - many, if not most, villains commit crimes against property. They steal or break stuff. Maybe they take a hostage spur-of-the-moment or put a civilian (or intervening cop) in danger to attempt to escape the hero. But they don't set out to kill people, no one is seriously hurt, or they plea it down to a lesser crime.
- The system can't convict them
Superheroes are cool. They swoop down, exchange some witty banter, stop the bad guy, and tie him up. Maybe they leave a note for the cops.
Unless the villain has been extremely public about his actions and the police already have a warrant out for him, there's not much the justice system can do. To the impartial eyes of the law, a supervillain that Batman punches out and drops off in front of City Hall is also a victim of assault and battery. Sure, they may suspect him of other crimes, but unless they can prove it beyond reasonable doubt to a jury the villain is not going to be convicted of most of his crimes. Typically, masked vigilantes are persona non grata so far as the legal system is concerned. Sure, Batman may knock Riddler senseless, drop evidence beside him, and leave him for the cops. But the evidence will be obviously planted, there will be no chain of custody linking it to where Batman removed it from, and Batman (who has no legal identity) can't testify.
- The villain is outside the jurisdiction of our justice system
Superman is a deputized member of the Metropolis police force. Unlike most heroes he can and does testify in court. Unfortunately, this is of limited use when his foe is Darkseid - Apokalypse is unlikely to extradite him. Even when it is a terrestrial villain, say he helps Batman take down Toyman in Gotham, he will have been operating outside of his legal jurisdiction.
Honestly, the majority of times the villain can't be touched by the courts due to jurisdictional matters, the villain will fall into the list of exclusions in the question. Most of the time, villains would be able to be tried in the city/state/country where their crimes occurred.
- Political or Legal reasons prevent it
Magneto is committed to the genocide of humanity. He has murdered in cold blood, and ordered or coerced others to do so. In any state which has the death penalty, he's earned it (assuming he acted within their jurisdiction). Will the prosecutor seek the Death Penalty, though? There's many compelling reasons not to do so. Firstly, it may very well create a martyr - judicial murder of Magneto may cause his followers to violently revolt.
Secondly, many super-villains may be happy to sit in prison for a while - they often use this time to plan their next caper, make connections, etc. They may NOT be fine with sitting on Death Row. I pity the guards on duty when Deadpool or Sabertooth decides they're done sitting nicely in the cell.
Third, it may be impossible to execute a criminal in a legal manner. There are very few methods of execution permitted in the eyes of the law. What happens when the convicted serial killer is Deadpool (and he is somehow prevented from getting away)? How do you execute someone who regenerates from almost anything? There ARE ways to kill people/things that regenerate quickly, but all of them would run afoul of the 'cruel & unusual punishment' clause.
Also, to be executed, the prisoner must be of sound mind. Joker is a prime example of this - he is literally certifiably insane (depending on the writer). Many of Batman's villains are similar (which is why they typically go to Arkham Asylum). Some of them (notably Edward Nygma) have even reformed after treatment, becoming law-abiding members of society. The judicial system is set up to avoid putting people with legitimate mental problems to death or incarcerating them with the general population (note that in real life this is not terribly effective). The typical reaction to someone being judged incompetent to stand trial is for them to be treated until such a time as they ARE competent to be judged for their actions (unlike how popular media portrays it). In comics, though, most people aren't easily treatable and will inevitably escape before treatment can be completed.
- The villain is untouchable
So Doctor Doom came to the US and planted a bomb, threatening to blow up something. The Fantastic Four, as is their idiom, stops him. Doom is the leader of Latveria, who will demand he be repatriated. He may have diplomatic immunity, in which case the worst that can happen is expulsion from the country (though the laws which set down diplomatic immunity DO say that it is against the spirit of the laws to abuse it in this fashion). Many supervillains have foreign political connections, and putting them on public trial (and potentially to death) would have foreign policy implications that make it impractical.
Lex Luthor or Wilson Fisk is another example - they have immense political connections, and vast financial resources. Hell, in Ultimate Spiderman Wilson Fisk (Kingpen) murders a man while being recorded by his security system. He does it in full view of the camera, in cold blood. The police find the body, and Spiderman eventually recovers the security footage, delivering it anonymously to the police. It takes a year, but Fisk's lawyers eventually get the charges dropped (see issues with hero-derived evidence in my 2nd point).
In comics, as in real life, money and power make it really hard for the legal system to convict you with a strict sentence.