David is a subversion, as the heroes are the ones that mete out his karmic punishment rather than the villains he threatened to betray them to.
Chapman, as a teenager, tries to offer the human race to the Yeerks in order to save himself, which is ultimately what starts the invasion and leads to his own infestation.
Averted in Tom Clancy novels, the American and Soviet characters make it clear that defectors must be rewarded and protected in order to encourage other defectors. It is part of the unwritten rules of espionage. Furthermore, assassination of a defector is a violation of the unwritten rules and even kidnapping a defector can be punished with death for the kidnapper. The espionage game is supposed to be civilized. The rules are more gray/grey when applied to proxy wars.
Star Wars Force Commander: After proving their loyalty in combat, Tyr Taskeen allows several imperials to join the Rebellion as trusted officers. This is common in the Star Wars universe; defectors are only executed if discovered before they actually defect. Their new superiors trust them after a heroic action or the revealing of top-secret information.
Justified since a majority of the Alliance leadership and many of its most famous heroes are Imperial defectors. It also helps that the vast majority of Imperial defectors tend to be Punch Clock Villains who only switch sides when they realize how bad the Empire is.
In J. R. R. Tolkien's The Silmarillion, Sauron tells his captive Gorlim that he will be reunited with his wife Eilinel (apparently captured by Sauron) if Gorlim reveals where the heroes are. Gorlim gives in, at which point Sauron reveals that Eilinel is already dead—and Sauron does, indeed, reunite Gorlim with her.
In Dune, Dr. Wellington Yueh betrays the House Atreides for the sake of freeing Wanna from Harkonnen tortures. Yueh is an interesting case in that he walks into it with his eyes mostly open — he strongly suspects that Wanna has been Released to Elsewhere and is betraying everyone just to get close enough to the Baron to kill him in retaliation. He knows he'll only be killed for his troubles once he's outlived his usefulness, and while he does deliver the Duke Atreides to the Harkonnens he does ensure that his consort and son escape, and replaces one of the Duke's teeth with a poison gas capsule for killing the Baron. Sadly for him, subsequent history remembers him as worse than Judas and for thousands of years his name serves as a byword for unconscionable treachery.
"You think... you have defeated me? You think I did not know... what I bought... for my Wanna?"
Combined with False Reassurance in The Three Musketeers. One treacherous character gets rewarded for aiding Cardinal Richelieu and has the bad judgment to "remind the Cardinal he is still alive" with what is presumably a letter begging for money. The Cardinal's response is that he will "take care of him for the rest of his life". The reader is informed a page later that the guy disappeared one day and is assumed to have spent the rest of his life "secure" in a castle with all of his meals provided. The character appears again, much transformed, in the sequel. Exactly what he went through is not clear, although it's unlikely Richelieu really cared what happened to him.
Harry Potter. Despite his crucial role in Voldemort's return, Wormtail isn't rewarded much apart from getting his hand replaced. Voldemort himself says he was unimpressed by Wormtail's lack of loyalty to him. A few books later, he is posted to Snape's house, where Snape uses him as a servant. In the final book, his "reward" was a sort of loyalty insurance. The moment he resisted Voldemort and tried to help Harry, even if it was a fraction of a second of consideration, the hand would strangle him. And that is exactly what happened.
In the Susan Cooper novel The Dark Is Rising, Merriman Lyon's servant Hawkin betrays him and goes over to the Dark. At the end of the novel, the Dark callously throws him down from a great height, severely injuring him.
Romance of the Three Kingdoms plays this trope straight and averts it in some instances: Good civil servants and military officers were in need, after all. Several officers that would become practically synonymous with one of the Three Kingdoms started out fighting that kingdom (Zhang He, Zhang Liao, Taishi Ci, Gan Ning, Ma Chao, and Huang Zhong to name a few) and none were thought any less honourable for having switched sides. They however, usually changed allegiance after their lord was dead or surrendered and most of them went over openly. Most backstabbers and people who actively betray their lords feel the wrath of this trope:
When Lu Bu begged for his life, Liu Bei reminded Cao Cao that Lu Bu had already betrayed three people at that point (making him almost an aversion: his first three treasons were heavily rewarded), two of whom he had killed, and the third being Liu Bei himself. In the novel they contrast this with Zhang Liao, who mocked Cao Cao and was prepared to die, until Guan Yu and Liu Bei begged Cao Cao to spare him. Since he was an honorable warrior, Cao Cao agreed and Zhang Liao became one of his greatest generals.
Miao Ze: I desire no reward, only Chunxiang for a wife.
Cao Cao: For the sake of a woman, you destroyed your brother's entire family. A man so faithless does not deserve to live.
Yang Song was an officer of Zhang Lu that received several bribes from multiple sides. When his lord surrendered to Wei, Zhang Lu and most of Zhang's surviving officers and officials were given positions in Cao Cao's administration. Yang Song was passed over, and when he went to Cao to complain, Cao had him executed.
Wei Yan was also one of the most notorious traitors in the novel (having betrayed Liu Zong, and then Han Xuan in attempts to go over to Liu Bei's side), but he both fits the trope and subverts it, depending on who he is serving at the time. Liu Bei tends to deliberately overlook Wei Yan's faults after Wei Yan joined him and, as a result, Wei Yan remains loyal to him; Zhuge Liang has a vehement dislike of Wei Yan ever since he joined, however, and after Zhuge Liang's death, Wei Yan plays true to form and attempts rebellion. Zhuge Liang, who has foreseen Wei Yan would do so, promptly plots with Ma Dai to incite Wei Yan to rebelling and then has Wei Yan killed for it.
In Mercedes Lackey and Andre Norton's The Elvenbane, a wizard decides that the rebellion against the elven overlords is doomed to failure and attempts to buy his survival by offering his services and his knowledge of the rebels' secrets to an elvenlord. The elvenlord smiles encouragingly, listens to him carefully, and then tortures him to be sure he wasn't lying and finally reduces the man to ashes when he's done.
Averted quite notably in Victory of Eagles: Napoleon's offer in the last book of sanctuary for Laurence and Temeraire ("I will not insult you with offers of treasure"), or barring that free passage to China, in return for the plague cure was at least in part a coldly logical tactic for keeping the bloodline of the Chinese Celestial breed away from the British. However, during increasingly violent foraging raids from occupied London, despite the fact that both Laurence and Temeraire were both serving the British once more, Laurence's family estate remained untouched apparently out of nothing more than sheer gratitude.
Done with a twist, in This Rough Magic by Mercedes LackeyEric Flint and Dave Freer. The Hungarians threaten a man's son in order to get him to give the location of some heroes. The man does this and finds his son has been killed anyway, but then the heroes help the man to escape with his life and tell him to go tell everyone about this, which creates bad publicity for the Hungarians and helps the heroes defeat them in the end.
In Barrayar, Cordelia walked in on a conference where two of Vordarian's men were trying to sell him out. This was no longer possible, of course, because she had Vordarian's severed head in the shopping bag she was carrying, but she advised them to throw themselves unconditionally on Lord Vorkosigan's mercy, adding, "He may still have some." Although she didn't speak the words, "I certainly don't," everyone in the room heard them.
Littlefinger does this in A Song of Ice and Fire, having the man who helped sneak Sansa out turned into a human pin-cushion as soon as his job was done.
The Small Council in A Feast for Crows suggest doing this to House Frey after their horrific betrayal of House Stark/Tully in the Red Wedding, but Cersei just tells them to let them be, considering that Walder Frey is very old and is likely to die soon.
The first however is a combination of You Know Too Much / You Have Outlived Your Usefulness, while the Small Council is seeking to distance itself politically from an atrocity committed with their secret approval. The only person who expresses distaste for such a traitor is Jaime Lannister when confronting Lady Spicer and he still sticks to his father's agreement to reward her with titles and good marriages for her family (though not quite the ones she was hoping for) so this is also an aversion of this trope. A Lannister, after all, pays his debts.
King David was fighting a civil war against King Saul's successor, Ish-Bosheth, and two opportunistic officers assassinated the enemy king and presented his head to David in anticipation of a reward. He executed the traitors, cut off their hands and feet, and hung their corpses up by the pool at Hebron as a warning to others. As for Ish-Bosheth, David ordered him buried with full honors. This is also in keeping with how he treated an Amalekite who came bringing his predecessor Saul's crown and armband, claiming to have done a mercy-killing on Saul himself. Although David presumably found out later (after executing him) that the man was lying, he cited his decision concerning this other man to Ish-Bosheth's murderers, pointing out that what they'd done was far worse.
The Bible also has two aversions. The first one: Balaam showed his loyalty to Yahweh even though his life was at risk and blessed the Israelites rather than cursing them as God told him to. He was killed for trying to have it both ways. He wouldn't betray God by pronouncing a curse where a blessing was required, but he still wanted the reward that the Midianites were offering to him. So he taught them how they could turn the Israelites away from the commandments of God and bring His curse upon themselves, making him a pretty straight example of this trope.
Second one: The prostitute Rahab gave aid and comfort to two Israelite spies, allowing them to bring back information that allowed them to annihilate Jericho. Joshua spared her, and she became one of the ancestors of Christ! note Rahab married Salmon and became the mother of Boaz (Matthew 1:5) from who David's paternal family came.
In Artemis Fowl, Mulch attempts to sweet talk some goblins by claiming he doesn't approve of the dwarf/goblin tunnel wars and is actually a goblin sympathiser. In response, the goblins attempt to kill him; the only thing they hate more than a dwarf is a traitor to his own kind, and Mulch ticks both boxes.
In the Iliad, Dolon was captured by Odysseus and Diomedes and interrogated. To save his life, he quickly tells everything he knows. Then Diomedes kills him for speaking too easily.
In the Redwall series book Mattimeo, Slagar adds a defecting shrew to his chain gang of slaves after the shrew volunteers useful information.
Slagar is a double-crosser anyway, promising his slaver recruits the sky only to abandon those who haven't died along the way and pit them against each other.
Badrang in Martin the Warrior does this.
Subverted by Tsarmina in Mossflower, who states that not invoking this trope is the only reward for defecting to her side.
A spy in The Bellmaker is warned about this by Urgan Nagru, the Big Bad, after he offers information on Nagru's mate (they're constantly plotting against each other) after the rat suggests a reward would be in order. He's then happy to escape with his life.
In The Dresden Files, the Winter Knight Lloyd Slate betrayed Mab, and the way she punished him was... excessive. She entombed him in ice, crucified on a tree of the same, until he's almost dead from frostbite and exhaustion... at which point Mab takes him out, feeds him, heals him, and takes him to bed with her, only to return him to his torture when he wakes up.
Mab: To be sure, the White Christ never suffered so long or terribly as did this traitor. Three days on a tree. Hardly enough time for a prelude. When it came to visiting agony, the Romans were hobbyists.
Averted with Harry himself: when he tried to cheat Mab of her Knight, she was not only amused and proud, but she risked reality itself by spending six months healing him.
In Repairman Jack novel By the Sword Yakuza interrogate a local mook by threatening to cut off his pinky. The man caves in and gives the information. Then Yakuza cut off the finger and swallow it (to prevent re-attachment) for ratting on a friend.
The Stand: Randall Flagg, using a few different methods of persuasion, manages to convince Harold Lauder to try and destroy the good guys' governing committee, post-apocalyptic plague. Lauder sets off the bomb and heads out to join Flagg's burgeoning army in Las Vegas. However, Flagg arranges for Harold's death on the way, and Flagg's surrogate basically says, "Once a betrayer, always a betrayer."
Septimus Heap: When Simon has told the Supreme Custodian about the location of Zelda's cottage, the Supreme Custodian plans to kill Simon along with the other Heaps.
Averted, surprisingly enough, in The Prince. Machiavelli expounds on how this Trope is actually bad practice. Any advantage the Prince can cultivate against his enemies is a welcome one, and if there are people working for his enemies that are willing to turn on them, they should be encouraged, and then fairly rewarded if said betrayal works to the Prince's favor. The Prince is essentially gaining an ally in the traitor, and someone who punishes his allies for helping him will soon find himself without any.
Simliarly, in The Art of War, if an enemy turns to your side, you should treat him well, and encourage others to do the same, though this is told in more of a Defeat Means Friendship style.
Averted in The Legendsong Saga when Glynn is rescued by myrmidons on Fomhika. Instinctively trusting her, they take her back to the inn where several Darkfall allies have gathered and, despite her attempts to leave, offer her the chance to join them. Hella then reveals that Glynn is working is working for the Drakka and they realise she now knows too much, but they offer her the chance to spy on the Drakka for them instead. Glynn is tempted to take their offered escape, but her sense of honour forces her to refuse. Duran is impressed, and reveals that if she had accepted she would have allowed one of the other myrmidons to kill her. Instead she lets her go, offering friendship and requesting that Glynn reconsiders about her loyalties.