One character sees another getting away with something that is against the rules. If he speaks up everyone ignores him. So he decides to join in, and commits some very minor violation. He is immediately caught and has the book thrown at him.
Almost always played as comedy trope, this trope can range from a single scene to a whole plotline. It is is rarely done as drama, despite the dramatic potential. It is a fairly subversive trope, showing a poor fit between actions and consequence.
See also Arson, Murder, and Jaywalking. Can be related to Can't Get Away with Nuthin' , or Can't Get In Trouble For Nuthin'. If someone tries to imitate the Karma Houdini, they'll end up like this. Protagonist-Centered Morality would be a subtrope of this.
This is very much Truth in Television - in some online forums as well as in Real Life.
For example, most of Ranma and Akane's fights are either Akane's fault (when she keeps jumping to negative conclusions about Ranma, or trying to feed him terrible cooking), or Ranma's fault (when he keeps insulting her). The problem is that because Akane is surrounded by family and friends that are close to her, and because Ranma's only close relation is his father (who is almost never on his side, anyway), Ranma's usually the only one being punished, while Akane gets away scot-free. This has served as Fanfic Fuel for a lot of fanfics in which Ranma finally gets fed up with this situation, but in the actual anime/manga he seems to take it pretty well with only some token grumbling.
Another example is the fights between Ranma and Ryoga. Ryoga has the advantage of sometimes posing as P-chan, Akane's favorite pet. So when Ranma and Ryoga get into disagreements, all Ryoga has to do is turn into P-chan, and Akane will always side against Ranma for "picking on a poor defenseless pig".
In a story of Iznogoud, the eponymous evil vizier tries repeatedly to have the Caliph commit a diplomatic faux-pas with a Mongolian ambassador, which would force him to either step down, resign his position or possibly even be killed on the spot by the outraged representative. No matter what the vizir suggests, however, it results in the Caliph getting a cheerful, happy response for somehow following some bizarre and obscure tradition of his visiting guests. Then Iznogud says "drat" in response to the last of his failures, which results in the ambassador angrily taking offense to that word, and demanding the vizier's life in slavery lest war be declared on the spot. The Caliph gleefully agrees, insisting that "his good vizier would surely agree in the interest of peace." Gilligan Cut to Iznogud being dragged off in chains wondering what the hell just happened.
Anger Management centers on this trope. An excessively passive man is sentenced to anger management classes for allegedly (but not really) starting a commotion on an airplane. And it happens again, each time with him accidentally insulting or harming a woman/ disabled person/ ethnic minority that would ensure that no jury would pity him. It was all a Massive Multiplayer Scam, with these manipulative folk being presented as the good guys. Except the guy with the tazer. He was just having a bad day.
Outlaw playes the trope straight for drama. In the film, the London Metropolitan Police is horrendously ineffective at dealing with professional criminals and hooligans, but when the protagonists form a vigilance committee and start beating up dealers and robbing money launderers a corrupt cop turns them into public enemy #1. 2/3rds of the remaining protagonists wind up getting gunned down by armed Flying Squad members in the end.
Bicycle Thieves: A non-comedic example is this classic Italian film. The protagonist, Antonio, has his bicycle stolen which he needs for his job. Eventually, he tracks down the thief, but the police lets him go, because Antonio doesn't have any proof and his neighbors lie for him. Out of desperation, Antonio tries to steal a bicycle himself, and is caught immediately.
In the Wayside School books, Todd always gets in trouble three times over the course of the day and is always sent home early on the kindergarten bus. On multiple occasions, this is due to a selective enforcement plot when the rest of the class gets away with things, but he gets caught for a minor infraction. For example, the whole classroom will be talking loudly with the teacher not paying attention, but the second Todd opens his mouth, the entire class is silent and he's caught talking in class. Similarly, one scene has Joy bugging him over what page he's on in the math book, and mocking him for being so far behind her. Her mocking gets very, very loud. But when he finally loses his cool, he's the one who gets in trouble. Immediately after he saved the lives of everyone in the class.
Snape from the Harry Potter series is biased and unfair towards the Gryffindors - deducting points from the protagonists and giving them detentions for no cause or for minor infractions - while typically ignoring wrong-doing by Slytherins.
In Becker, Dr. Becker makes several attempts to go see a particular movie which fail because of loud, disruptive people in the cinema. At a later attempt he practically gets crucified because Margaret keeps talking to him.
In Friends, Ross finds out that students are sneaking into the library stacks for sex (particularly the aisle containing his thesis). The library refuses to do anything about it. He decides to monitor the aisle himself, meets a pretty grad student... and ends up getting caught by the librarian.
How I Met Your Mother: Marshall talked his way out of a ticket by offering to bring the cop to his barbecue. Robin, being a pretty girl, can get out of a ticket easily. Barney? No way.
It doesn't help that he takes getting out of a ticket as a challenge and proceeds to get a dozen tickets as a means of proving that he can get out of one.
Used in Police Squad! when Frank Drebin is trying to goad "The Champ" into accepting a prize fight with Bobby Briggs.
Frank Drebin: Bobby Briggs could break every bone in your body. The Champ: Yeah, well he must be a pretty good boxer. Drebin: Well, how would you know? You never won an honest fight in your life. The Champ: Hey, take it easy. Nobody wants to get hurt. Just cool off. Drebin: Why should I? The only reason you're champ is cause of guys lying down or dying. The Champ: Hey, let me buy you a drink. Drebin: I wouldn't drink with you, you two-bit phony excuse for a fighter. The Champ: You're just tired. [pats Drebin on the cheek] You didn't mean it. Bobby Briggs:[to Drebin] Aw, forget it. The ChampForget it?Nobody says "forget it" to me! [takes a swing at Briggs]
Happens a lot on The Andy Griffith Show whenever the plot requires it. Andy seems less intent on actually enforcing the law than he is in promoting his own sense of values, and it always seems to work out. Barney, on the other hand, can't seem to tell where to draw the line on anything he's involved in.
Drake & Josh when Drake does something wrong no one does anything about it, but when Josh tries to do the same everyone has almost laser precision of what he is doing.
In The Elder Scrolls, most of Tamriel is above the law. In Morrowind or Oblivion, if they slept on the street, the guards would simply get stuck trying to walk over them. You decide to do the same and the guards are right there yelling "STOP RIGHT THERE CRIMINAL SCUM!"
Skyrim example: Assaulting a child in public, no problem. Stealing an apple? Arrest and possibly execution on the spot, not to mention several bystanders will try to exact vigilante justice while the guard is talking to you.
An early Grand Theft Auto: San Andreas mission has you fleeing on bicycles from gangsters shooting at you with machine guns from a car. The police won't responds even as they stand in the gangster's line of fire, but so help you if your bike bumps into them.
This is pretty much the standard for virtually anything in GTA. Although it's common to see officers chasing after other people, the cops will never bust the psycho with the SMG shooting at you from a pimpmobile. Oh, and you'll get stars for shooting back.
Subverted in Grand Theft Auto: Vice City, while you get stars for shooting back, you also get rewarded for stopping (non-lethally) criminals who are fleeing from cops.
Averted in Bully. You cause a problem in front of a Police Officer or Prefect you will get taken down. Some NPC causes a problem (even if its against you) in front of a Police Officer or Prefect he or she will get taken down just the same.
In one episode of Lenny and Barney play pranks on Moe which involve setting him on fire and setting a cobra on him. Homer, in an attempt to join in the "harmless" fun loosens the lid on a sugar cellar, resulting in what Moe angrily calls "the old sugar-me-do". This gets Homer banned from the bar.
In "The Monkey Suit," Chief Wiggum arrests Lisa for teaching her classmates about evolution (which got outlawed and she was rebelling against that rule). She protests that there are much worse crimes, pointing to Snake, who is shooting people from atop the Kwik-E-Mart. Wiggum explains that it's because they only have enough funding to enforce the most recently created law (thus literally "selective enforcement") although Wiggum does admit is "not the best system - in fact it's pretty much the worst."
In "Burns' Heir", Homer will allow Bart flinging peas at Lisa, but he grounds him for feeding his meatloaf to the dog (especially because it was an endpiece).
Burns also laughs his butt off when Homer throws pudding at Lenny. But the moment he through one at Carl he snarls at him and goes to help Carl.
Invader Zim: In the episode "Parent Teacher Night", everybody is conveniantly staring silently in the opposite direction of the mess loudly made by Zim's robotic parents. But after they leave, and Dib tosses his juice cup to the ground in frustration, someone turns around and shouts "Hey! That kid's throwing punch!" and the episode ends with Ms. Bitters descending on Dib like the wrath of Godsome kind of snaky demonic Satanthing.
Foster's Home for Imaginary Friends: Inverted as a Springtime for Hitler in the episode "Crime After Crime". The episode's B-plot has Frankie cooking something disgusting for dinner, so Bloo causes trouble in an effort to get sent to his room without dinner. Unfortunately the episode's A-plot was Mr. Harriman acting hyper-paranoid over someone discovering his addiction to carrots, leading him to punish everyone else in the house for relatively minor infractions due to thinking they're "on to him" while completely ignoring or even congratulating Bloo.
Sponge Bob Square Pants: In Bikini Bottom, harassing your business rival to near-suicide, destroying stuff because you've got the IQ of a turnip, or being an all-around annoying jackass with No Indoor Voice is perfectly acceptable. Littering, however, can get you an orange jumpsuit. Just ask Squidward or Mrs. Puff.