The ending of Fallout is a pretty stunning invocation of this trope. You've saved your Vault and the entire wasteland, but when you try to return home the Overseer exiles you so your story doesn't inspire other Vault dwellers to leave.
Fallout 3 quotes the original's ending almost word-for-word when you finish the "Trouble on the Home Front" quest. By leaving Vault 101 at the beginning of the game you've sparked a civil war between a faction that wants to leave and another that's convinced the Vault is the only safe place in the world. You can stop the bloodshed and bring the conflict to a peaceful resolution, even get your childhood friend chosen as the new Overseer, but she'll ask that you leave because your presence is dangerously disruptive.
If your karma is too high, you will be hunted down by Talon Company mercenaries, who said you have 1000 caps on your head. Inverted if you are evil as well, as you will be hunted down the same way by the Regulators.
Similarly, if you refuse Mister Burke's Fusion Pulse Charge offer or disarm the bomb without speaking to him first, he will also randomly send Talon Co. hitmen after you.
In Point Lookout, siding with Desmond and placing the jamming device on the Ferris wheel will permanently turn the Tribals hostile.
Fallout: New Vegas makes finding happy endings for your companions difficult. Help Arcade link up with his foster family and fight with them at the Second Battle for Hoover Dam? Odds are good he'll end up a military prisoner or run out of the Mojave by bounty hunters. Convince Veronica to leave the isolationist Brotherhood of Steel to do humanitarian work with the Followers of the Apocalypse? Oops, angry Brotherhood Paladins have slaughtered the entire Followers outpost so Veronica can't share their secrets.
In a Dummied Out event restored in certain mods, if you manage to save Benny from the Legion, he'll make an attempt to ambush you later on, mocking you for being a "goody-two-shoes" and being stupid enough to trust him.
In Betrayal at Krondor, Gorath's method of saving his race, namely by warning their sworn enemies about the planned invasion to nip it in the bud and prevent another costly war, unfortunately happens to be one that his entire race condemns him for. Ultimately, his heroism directly leads to his death - had he not been merciful enough to be willing to spare Delekhan even after everything he had done and had simply killed him when he got the chance, the Lifestone never would have been endangered and called for him to protect it at the cost of his life.
Poor, poor Marona. Frequently a victim of this throughout most of Phantom Brave.
Played for comedic purposes in Disgaea 3 during the Almaz ending. He was right to stop Mao, but ends up losing everything for it. Possibly a case where Yank the Dog's Chain went too far.
Taken to extremes in Disgaea 4 with Artina's death being caused by her healing someone. The recipient becomes an Omnicidal Maniac as a result of said death.
Deconstructed in Castlevania with Lisa, who was burned at the stake for practicing medicine. Dracula does NOT take this well and resumes his war with humanity.
Ramza in Final Fantasy Tactics is one of the only legitimately good people in the story. His run of bad luck starts when he tries to help a desperate squire (Argath) rescue his Lord and Ramza's own brother subtly suggests how to go about it, which leaves his home at Eagrose undefended when the Corpse Brigade comes by to kidnap his best friend's sister. When the entire world is full of jerkasses, not being a jerkass is asking for trouble. For Ramza to actually go around telling all the Jerk Asses to knock it off? Super trouble. In addition, Ramza is arguably one of the only people who survives (he either directly or indirectly killed a good amount of everyone else), and he's eventually vindicated by history, albeit hundreds of years later.
Colette from Tales of Symphonia qualifies. Always nice to people, yet fate seems to hate her for no reason.
It also happened to Mithos in the backstory.
Vincent from Final Fantasy VII. He was a Turk (basically an elite hitman), yes, but was a genuinely kind person who fell in love with the woman he was assigned to protect. This woman then proceeded to break his heart and get married to the resident Mad Scientist, getting pregnant with his child almost right away. Vincent pulled an I Just Want My Beloved to Be Happy and continued protecting her, until she started experimenting on her unborn child with her husband's help. He then confronted her husband about this, wanting nothing more than to protect her and keep an innocent baby from pain, and was consequently shot in the chest. Instead of letting him die peacefully, Lucrecia and Hojo made him into their newest lab rat, performed several horrific experiments on him, shoved four demons into his psyche, and then tossed him into a coffin to sleep for the next 30 years. And yet, he blames himself for all this mess. The amount of guilt he places on himself is incredible, especially since he was practically blameless.
Similarly, the woman who left him basically did it out of guilt for her part in Vincent's father's death when both were trying to research Chaos.
Chaos in Dissidia: Final Fantasy was shown to be somewhat merciful toward his minions, even being a bit unwilling to punish them if they disobey him. Unfortunately for him, this also results in most of the villains not being truly loyal to Chaos, to the extent that once he offs Cosmos, they end up doing their own thing, abandoning Chaos, with only Garland remaining by Chaos' side.
His father Cid didn't have it any easier. Cid was an inventor and scientist who only wanted to help protect the people of Onrac during a war. His reward for his work was to be imprisoned along with his innocent wife after refusing to preform unethical experiments. After he and his wife manage to escape, they agree to take the time to rescue Chaos and Cosmos from their imprisonment. This act leads to Cid's wife being shot while he Chaos and Cosmos get trapped in an alternate dimension.
Luigi, though this is played for comedic purposes since he's become a Chew Toy.
Subverted in Odin Sphere. Gwendolyn (outside the battlefield) is actually a pretty kind and caring person. She exposes and eliminates a traitor and rescues her half-sister Velvet (despite her own feelings) to ease her father's pain. Her reward for this is to be stripped of her status as a Valkyrie, enspelled into magical slumber, and married in her sleep to a complete stranger to whom she is expected to be completely subservient — but the powers that be give karma the finger by manipulating destiny so that her new husband is Oswald, a man who has very strong feelings about anyone being treated as property and who turns out to be Gwendolyn's perfect match (not to mention desperately in love with her). The two of them, and their marriage, prove to be part of the key to saving the world from Armageddon.
In Fate/stay night, Emiya Shirou stays at school late to sweep the archery dojo as a favour to his friend Shinji. This gets him stabbed in the heart. By Cúchulainn.
Also, Archer. His entire life turned out to be one big example of this trope as a result of his blind devotion to his ideals, and he keeps on doing it even after death.
In Fate/Zero the only thing Kayneth did which could be considered an act of kindness—giving up at the Grail War (with it his only chance to restore his pride and damaged body) to save his fiancee's life—gets him killed immediately after.
In the good ending for Phantasy Star Portable, you and your partner's reward for saving the galaxy is being discharged from the Guardians and being branded traitors because your partner was an unknowing (not to mention unwilling) pawn in the Big Bad's scheme and you refused to leave her behind. Is it any wonder the Guardians aren't very well liked in part 3?
In Shadow Hearts: From the New World, we learn that the main antagonist is hero Johnny Garland's older sister, who sacrificed her mind and memory to bring him Back from the Dead. She ends up wandering the land in a silent, amnesiac daze, slaughters the innocent, loses her love interest and fails to revive him, and the final battle against her is fixed so that Johnny is the one to kill her. Given what she had become, this could be seen as a Mercy Kill.
Mass Effect 1 pulls the fake-distress-call-leading-to-a-trap routine on the player.
If you repent for killing the Rachni queen in the first game by saving the false queen in the third game, she'll eventually betray you and severely damage your military.
Meanwhile, in Mass Effect 2, turns out Elnora really was as bad as you thought she was. Too bad you let her go.
Mostly, though, you're not really punished. ME2 even encourages you to be the Team Therapist by completing all those side missions, since if you don't, then most or all of your team — possibly including Shepard — will die.
In Mass Effect 3 if you managed to talk Wrex down, you're stuck with a no-win situation with the Salarians and Krogans. If you support the Salarians, you have to kill Wrex and lose the clans; if you support the Krogans, the Salarians withhold a fleet. Only if you killed Wrex can you get the benefits from both sides by betraying the Krogans. This can be averted, however. If Kirrahe survived Virmire and subsequently survives the Cerberus attack on the Citadel, he will give Shepard the STG's support, even if it means defying the Dalatrass if you sided with the Krogan. If Kirrahe isn't available, Thane can help out in his stead, and you'll still get support from the STG, who declare the Dalatrass an ignorant idiot still trying to hold on to old grudges and help you out of respect for Mordin's sacrifice.
Did you rewrite the Heretic Geth? Congrats, you just made getting the geth and quarians to make peacethat much harder.
In the third game's Spectre terminal, if you authorize the transfer of a soldier who is concerned about fighting Cerberus because she might go up against her brother so that she will serve against the Reapers, you will suffer a small penalty to military assets.
It's mostly averted as being a paragon will generally get Shepard more resources in the fight against the reapers.
Happens in spades to Norman Jayden from Heavy Rain. If he goes to the warehouse to save Shaun, he slowly succumbs to his addiction to ARI and inability to differentiate it from reality
Massive irony (and massive spoilers) in one possible endings. If the Big Bad selflessly saves a certain person's life, and kills all the heroes, he'll appear to get away with it all in the end only to end up being killed by the one, completely unrelated person whose life he saved.
Well, that character wasn't completely unrelated - the Big Bad was responsible for the deaths of her husband and son, which she discovered before shooting him.
Subverted in Fahrenheit, at one point Lucas (who by this point is a fugitive wanted for murder) has the choice of saving a drowning boy while a cop who saw him leave the crime scene happens to be approaching. If he does save him, the cop does in fact recognize him but chooses to let him go.
Double subverted. Much later, the cop tells the detective investigating Lucas about the drowning boy incident, thus giving her a vital clue.
In the backstory to Gears of War, Dom testifies in Fenix's defense after he is charged with desertion for his entirely justified attempt to save his father. His "reward" is being demoted, facing public humiliation, and being hated by the top brass for "supporting a traitor".
Similarly, in Resistance: Retribution, James Grayson's reward for destroying 26 Chimera conversion facilities is... to be imprisoned and threatened with execution because he disobeyed one order.
Demon's Souls has you meet Yurt, the Silent Chief in the second part of the prison level while he is caged. He is dressed in black Sauron-like armor, and wields scythes, but he happens to be one of the few sane humans left, and claims to be here to help fight demons as well. When you let him out, he thanks you and says he'll remember this. When you return to the Nexus later, instead of finding the usual scene of just another NPC added, you find two dead bodies. If you do nothing, the next bodies will be those of the shop keepers (some of whom have items you can't get elsewhere). This continues until either you talk to him, where upon he attacks you, revealing that he was here to kill all humans left in the kingdom, or he runs out of NPCs and sticks around waiting for you to talk to him.
You also have Patches the Hyena, who every time you "help" him, he traps you with a horrible enemy, Satsuki, who if you're good offers you a quest to grab a sword where at the end he tries to kill you with it if you give it to him, tries to kill you to steal it if you don't, and just straight up tries to kill you if he see's you with it equipped, if you're bad, his evil version tries to kill you without even bothering with the quest, and of course there is the end of the game where you get to be a Monumental, a living seal for the Old One until you die, assuming that the Maiden in Black was just doing the same routine as last time, though this is up for debate. Oh, this also means that all Soul Arts will be gone from the world.
One of the main ways Red Dead Redemption shows that it is depressing and cynical as hell is showing how nearly every good deed John performs ultimately amounts to nothing. Help the desperate hooker make a new life for herself? Her pimp hunts her down and murders her. Help a Chinese immigrant get back to his lover? He dies of an opium overdose before he's even halfway there. Help a woman whose pregnant get funds from her illegitimate suitor? It turns out she's a con artist, and you just killed an innocent man (albeit in self defense) and left a distraught woman widowed...
Not to mention the ending. How does the Government thank you for doing their job and tanking down your old gang? They come after you.
The Elder Scrolls III: Morrowind: You may encounter a woman who will ask you to retrieve a ring from a pond. Say yes, hop in and grab it (if you can find the damn thing), and she and her visibly invisible friend will attack you. "No good deed goes unpunished, outlander," indeed.
So at the beginning of Singularity, an unstable time warp sends you back to 1955, right into the midst of a burning building and dying Soviet scientists. You find one man running for his life, only for the floor to collapse beneath him. Naturally, you grab his hand and carry him to safety. Oh, the catch? Turns out Dr. Demichev had cruelty to rival Stalin and because you saved him, the project he was working on went further than it ever had in the original history, giving him fantastic weapons that allowed him to take over the world. And the only way to undo it is to go back in time and kill yourself. If you do so, it causes a Snap Back to the beginning of the game so you don't technically die... then you find out you're in an alternate timeline where the Soviet Union still rules the world, albeit with a (hopefully) much more benevolent person in charge.
Return To Krondor plays this straight, at the beginning of the game no less. You can tear down a sweatshop that uses children as labourers. Now while this may give you a warm and fuzzy feeling inside, it turns out that there are consequences. The owner of the sweatshop, Yusef, worked for Jazhara's uncle in Kesh. You will encounter Izmali assassins - ninja-like killers who will attack you with poisoned daggers. They were apparently paid by Jazhara's uncle to kill you for meddling in the affairs of Kesh. You will encounter a group of them in the third chapter of the game, and another group roughly halfway through the game. In the second last chapter, you will find a dead group of these assassins. If you search their bodies, you will find out in a letter written by Jazhara's uncle that The Crawler, who Yusef was an agent for, pulled strings and is the one actually responsible for these assassins being sent in the first place. Jazhara's uncle is trying to tell her that he knows she was not meddling in the affairs of Kesh, and that there is little he can actually do, due to the Crawler being quite powerful and elusive. You can decide not to even investigate the sweatshop, and you will never be accosted by the Izmali assassins.
In Metal Gear Solid: Portable Ops, Big Boss, when he participated in the Mozambician War of Independence, rescued a war orphan named Frank Jaegar after fighting him, and placed him in a rehab facility hoping that he would recover and be safe. Unfortunately for him, he didn't realize until after the fact that some CIA personnel accessed the rehab facility and took Frank Jaegar and placed him into an inhuman experiment called the Perfect Soldier Project, of which he was the sole successful, surviving result, turning him into Null.
Civilization 4 has a random wartime event that tells you the enemy has shown unexpected mercy towards wounded prisoners of war, and that this could be a stepping stone towards negotiations for peace. The player then receives the option to either force a 10 turn peace treaty with a +1 bonus to the relations with the enemy civ, or continue the fight. The option to continue the fight actually says "No good deed shall go unpunished".
Support nice old man Harrowmont to keep ruthless fratricidal bastard Bhelen off the throne of Orzammar in Dragon Age: Origins? Congratulations, Harrowmont gets assassinated within a year of his coronation, and Orzammar is even more isolated and generally worse off than it was before you intervened.
One of the defining tropes of Space Quest. So you saved the galaxy, the ambassador of StarCon, and the crew of an entire starship, defeating the Big Bad for good measure. So what's your reward for doing so? You are forcibly and literally stripped of your rank, demoted to Janitor, and basically told to be lucky that you weren't convicted of war crimes.
Think Roger's got it bad? Meet the Hero in the Quest for Glory series. Especially from Quest for Glory II on, every good deed you perform just winds up lighting you up on the Big Bad's radar like the Fourth of July. Even though you do eventually get the adulation of the masses at the end of each game, you're put through utter hell in between, and in the end all it means is getting to take a breather before the next and even more trying adventure. It all comes to a head in Quest for Glory IV, where your heroic actions in this game and those before it leads to Katrina taking advantage of your selflessness for her own ends by manipulating and then outright forcing you (after you royally piss her off by rescuing her "daughter" Tanya and returning the girl to her rightful family) to release the local Eldritch Abomination from its prison. And to really grind the salt into the wound, you discover that she has genuinely fallen in love with you (the player can select dialog options that indicate it's mutual) just in time for her Heroic Sacrifice. And then in Quest for Glory V a loose end you left way back in the first game ends up running amok, killing the King of Silmaria to set off the entire plot and nearly murdering several of your friends and allies (and succeeding if you fail to perform the actions needed to save them). And then he reveals that for him, It's Personal.
The Paladin can have it even rougher than the other character classes, as you're expected to not accept rewards for doing good deeds. The manuals even directly reference this trope in all but name in regards to the Paladin's life.
In Dark Souls the "reward" for following through with the quest to link the First Flame is a horrible burning existence as the new Cinder. And it's doubtful how "good" this deed really is.
This sort of thing happens a lot in Dark Souls, especially when it comes to the NPCs.
Try to help Siegmeyer along his quest? He'll eventually either die trying to sacrifice himself for you or go hollow out of shame for not being able to repay you. The last is particularly tragic, as his own daughter has to kill him after he goes mad.
Tell Laurentius how you got more powerful pyromancies? He'll go hollow looking for Quelana, forcing you to kill him.
Help Lautrec out of his prison cell? He'll murder the firekeeper and take her soul.
Happens to Niko quite hard, depending on the choices you make with certain characters in Grand Theft Auto IV. One mission has you searching and killing a specific person and he begs for his life when you find him. If you let him go, he thanks you, but when you meet him again on the street later on, he "rewards" you by attempting to kill you. The end missions also enforces this trope if you decide to go on the Revenge path. Niko sticks to his morals and kills Dimitri for betraying him and putting him and Roman through so much hell. However, the deed comes back to bite Niko in the ass when Jimmy, the guy Niko refused to do the deal with, shows up at Roman's wedding and shoots at everyone, killing Niko's girlfriend, Kate.
Happens in Filia's ending in Skullgirls. After thinking about it, she decides that instead of curing her amnesia, she'll use her wish to give her former friend Carol (AKA Painwheel) a normal life again. However, the fact that she did this in small part due to feeling guilty for having mistreated her when both were still ordinary girls, the Skull Heart considers the wish insufficiently pure (wanting to assuage your guilt is selfish), so while Carol/Painwheel is returned to (almost) normal, and becomes friends with Filia again, Filia herself is doomed to a slow and painful transformation into the next Skullgirl.
A rare villainous example in Assassin's Creed III: Haytham Kenway saved Connor from execution once because Connor was his son. When Connor mortally wounds him, the dying Haytham admits he should have killed him long ago.
At the beginning of Xenogears, Fei tries to save his home town by climbing into a Gear (basically a giant robot) and fighting the forces that were invading. This results in the robot going out of control, completely levelling the town, and killing all but a handful of the inhabitants.
If you choose to give Iorveth his sword during the Mêlée à Trois betweehn the Scioa'tel, Loredo's men, and the Blue Stripes, thus honoring your agreement with Iorveth and giving you an advantage in the fight, then Loredo uses this as an excuse to provoke a mass race riot in Flotsam, resulting in the slaughter of hundreds of nonhuman civilians.
In the climax, if you choose to rescue your path's political prisoner instead of Triss, and thus discover the truth behind the Sorceress' Lodge's conspiracy and Letho's part in it, the epilogue reveals that this causes a genocidal campaign against all mages in the North, even ones who weren't even involved with the Lodge.
This is how the story for the Silent Protagonist, Rudy Roughnight, begins in Wild ARMs 1. He saves the village he grew up in by monsters, only for the towns people to reject and exile him for using Arms.
This becomes unintentionally invoked in Shadow the Hedgehog. Throughout the game, you're given chances to aid humanity in defeating the Black Arms or assist in the Black Arms invasion by doing certain things like healing respective troops and destroying property belonging to the respective factions. Doing so has benefits that come with it (You can usually tear through things faster than avoiding them, enemies you've healed won't attack you and stop doing Collision Damage, all of your work raises the Hero or Dark gauge.)but doing so does NOT affect the reaction of others in the stage, meaning that even if you've healed everyone you've come across thus far and ran out of ammo in your Healing Shiv, you'll still be getting shot at by that Hot Shot mech or Black Oak fighter as if you never did anything. Additionally, seeing as this is a Sonic the Hedgehog game, You'll have to use enemies as stepping stone frequently, with said enemies being whatever the dominant force of the stage is. Lampshaded by Sonic, who points out that they'll need to break a few G.U.N Beetles to continue on, even though doing so will piss off G.U.N
In Papers, Please, you can wave some people through even if their papers aren't in order, but this will get you a citation from the Ministry of Admission, leading to you getting your precious salary docked. Also, it might seem like a good idea for a loyal citizen of Arstoszka to hand over any EZIC papers to the MOI Inspector, but this leads to you getting arrested on mere suspicion of being in league with EZIC.
For all her nastiness, Metallia from The Witch And The Hundred Knight does become a decent person and does the right thing. The problem is that doing the right thing ended up backfiring on her horribly. To summarize, she spares a witch she was ordered to hunt down and lies so that she can escape. She also tries to create a potion to cure Visco of her curse in the presence of the king out of the goodness in her heart. Not only does the potion fail and cause the two of them lash out at each other, but the corpse of the witch she spared is brought before the royal court. Both acts together convince the king that witches aren't to be trusted and works together with the church to enact a massive witch hunt. Meanwhile, Metallia is imprisoned, tortured, and scheduled to be executed.
Neverwinter Nights: Referred to by name by Tomi Undergallows (a somewhat cynical rogue henchman) in Hordes of the Underdark when Linu (a more idealistic cleric) is restored to life by the PC. She explains that when she tried to help some slaves who begged her and Tomi for aid they revealed themselves to be shapechanged rakshasa and killed her. The PC might well have been taken in by the same trick, were it not for a helpful genie warning him/her about the trick at the last minute.