Give the Villain a Hero's Funeral

He was evil, by the lights of the protagonist. But he was defeated, and now he's dead.

But he was famous, or he was in a highly-placed position, or somebody influential trusted him. If the general public finds out that he was a villain, then his family will suffer or his employers will go out of business.

There's no choice. So that innocent people do not suffer (or to protect the reputations of the people in charge, in more cynical works), the higher-ups have no option but to Give the Villain a Hero's Funeral. The protagonist is rarely happy with this decision... but usually understands why it had to be made.

This is a subtrope of both Never Speak Ill of the Dead and Treachery Cover-Up. Compare with The Power of Legacy, where people are mislead for the deceased's protection or the people he betrayed aren't ready to tell anyone of his villany. Contrast with Redemption Equals Death, where the villain was no longer a villain when he died. If the villain is still alive but his superiors have ordered him to go get killed, that's Uriah Gambit.

Comic Books

 * Happens in Teen Titans during The Judas Contract arc. After Terra dies attempting to bury the Titans in rubble and they deliver her employer-lover Slade Wilson to the cops, they all agree that it's in their best interest that no one knows Terra joined the team specifically to betray them to H.I.V.E. and was pure evil. They give her a Titans funeral with honors. While Raven and Robin conclude that Terra was evil from the start and remain solemn, Beast Boy is in denial, and spends the funeral sobbing over the girl he loved. This has repercussions in a later arc where a villain in the future tries to replicate the exact same plot.

Film

 * A variant occurs in Batman: Under the Red Hood. Batman has a memorial for Jason Todd in the Batcave, to remind himself of the son he lost. After learning that the Red Hood is a resurrected Jason, who tries to get Bruce to break his code by killing the Joker, Alfred asks with sympathy and calm if they should dismantle the case. Bruce says no; despite what happened and what Jason is doing now, he was still a child when he died, and a hero.
 * The Dark Knight ends with this: after Joker corrupts Harvey Dent into killing five people and nearly murders Gordon's young child, Batman and Commissioner discuss that if word gets out about the truth, all the work that Harvey did will be for nothing because the criminals in jail will get released on mistrial. Batman looks at Dent's body, and turns it over to hide the Two-Face. He convinces Gordon to frame Batman for the murders instead. The movie ends with Harvey receiving a full civil servant funeral.

Literature

 * The Apollo Murders: It wasn't until Chad was told to make sure his story was straight before his trial that he realizes he was not only acting against NASA's interests but was also guilty of murder and treason. He drowns himself, but because of his high-visibility position in a program faced with massive budget cuts, NASA gives him a headstone at Arlington.

Newspaper Comics

 * Villainous inversion during Flash Gordon. One arc featured Emperor Ming capturing Flash Gordon, having doctors treat him, and then doing a public execution. Afterward, he erects a large ostentatious tomb where Flash's body will rest for eternity, to break the rebellion's spirit. Fortunately, a doctor helped Flash fake his death in thanks for a life debt, and he graffitied: "MING LIES; FLASH GORDON LIVES" on the tomb before making his getaway.

Oral Tradition, Folklore, Myths and Legends

 * It's a staple of Hindu Mythology. You can have evil people, demons, and deities, but if they stuck to their dharma and honor, they can receive a funeral that purifies them of their sins and ascend to heaven.
 * After Vishnu as his Narasimha avatar kills Prahlad's father for attempting to kill his son, Narasimha says Prahlad must have a boon for his worship. Prahlad requests his father is purified for his sins in death. Narasimha says if Prahlad takes the throne and rules wisely, that will be done. He gives his father a kingly funeral.
 * When Karna dies in The Mahabharata, the Pandavas just remember him as the charioteer boy that beat them in archery and the Number Two to the war's instigator, Duryodhana. It's only after the war that their mother Kunti begs them to give him a proper funeral, because he's their older brother. She had him out of wedlock and sent him out on the river, where charioteers found him. They don't take it well, especially Jerkass Arjuna, but give him a funeral.

Western Animation

 * In the Teen Titans adaptation of the Judas Contract arc, a variant is added. Unlike in the comic where the Titans were able to cover up Terra's treachery, they don't have that option when she leads armies of Sladebots into Jump City to forcibly take over and "evacuate" the civilians. When the dust is settled, literally, Terra is turned into a statue due to pulling a Heroic Sacrifice to stop a volcano she accidentally activated when fighting Slade. The civilians return, bewildered as they try to adjust to a normal life, while underground, the Titans place a memorial plaque by Terra's statue declaring her a Titan despite her betrayal, and flowers courtesy of Starfire. Raven, Robin and Cyborg say that she'll try to reverse the effects to bring Terra back, but Starfire and Beast Boy truly believe she's gone forever. The season five finale confirms Beast Boy visits her statue regularly enough to talk to her, and is shocked when it goes missing.