Sometimes the detectives/prosecutors have found out who the true culprit is, but there is simply not enough evidence to arrest/convict the perp.
However, sometimes the heroes demonstrate there are other ways to make the guilty pay that do not involve going outside the law themselves.
Justice by Insurance: In this case, the criminal has gotten a big payout from the insurance company related to the crime he actually caused. In this conclusion, while the justice system's hands are tied, the evidence presented is enough for the insurance company to take back their money saying that it was obviously claimed under criminal circumstances. Of course, the criminal could be stupid enough to sue, but that means his crime could be fully revealed and he is really sunk.
Justice by Lawsuit: The prosecutor was not able to convict the criminal, but the evidence amassed could be given to the victim and/or his family as good enough grounds to sue the criminal for everything they have in civil court.
Justice by Diplomatic Intervention: The criminal could skip the country or claim diplomatic immunity by his own nation, unaware that their government wants to haul him into their own courts and all they have to do is use the other country's court records to nail him to the wall.
Justice for Another Crime: The criminal can't be indicted for one crime, but he or she can get nailed for another. Tax Evasion instead of murder, for example. This one is often Truth in Television. May also be the discovery they had committed Felony Murder.
In Shaman's Tears, Joshua Brand is unable to arrest the Corrupt Corporate Executive for various crimes because the victims (genetically engineered lifeforms) are not technically human. So he instead arrests him for violating the Endangered Species Act after he realizes one of the genetically engineered constructs was created using the DNA of a black-footed ferret.
At the end of the Judge Dredd arc The Pit, Dredd has no evidence to convict Fonzo Bongo on being the head of his sector's branch of the Frendz crime syndicate. What Dredd does have, thanks to an observant rookie, is several hundred unpaid parking tickets in Bongo's name, earning him a sentence of twenty five years.
The Untouchables presents a good (although hardly perfectly realistic) depiction of how Al Capone, a notorious crime boss, was well-known to be guilty of crimes up to and including murder, yet since no-one could stick it to him, he was arrested for tax evasion.
In Tapeheads, the main characters get revenge on a Sleazy Politician by broadcasting a Home Porn Movie of him on live TV, which gets them arrested by the FBI. They're acquitted of the crime, but go to jail anyway for outstanding traffic warrants.
In Yellowbeard, the narrator at the beginning, after giving a laundry list of the title character's atrocities, including tearing men's hearts out and swallowing them whole, says, "Often forcing men to eat their own lips, he was eventually caught and imprisoned — for tax evasion."
Played for Laughs in The Campaign: Congressman Marty Huggins can't jail the Motch Brothers for their unethical campaign practices, because a lot of what they did was made legal by Citizen's United. They instead go to jail for harboring Tim Wattley, who was really an international fugitive.
In X-Men: Days of Future Past, Bolivar Trask never suffers legal reprisal for planning to commit genocide on his fellow human beings. Instead, he goes to prison for trying to pitch his killer robots to the Communist governments after America turns him down.
This looks like it's going to be the case in Seven Days in May. President Jordan Lyman knows the Chairman of the Joint Chiefs of Staff, General Scott, is planning a coup, but has no solid evidence. However, Lyman has letters from the general's mistress that he could use to blackmail him into resigning. In the end the President refuses to use such an underhanded method. Fortunately, a missing piece of evidence turns up at the last minute, and Scott is forced to resign when all his co-conspirators abandon him. And in the novel, two of Lyman's allies use the letters to force Scott to abandon politics forever.
In the gangster spoof Dickie Dick Dickens, our Villain Protagonist ends the first volume being arrested for bigamy, the result of an attempt to get a new identity going south.
The Lincoln Lawyerdiscussed the trope with a client charged with attempted rape. The eponymous lawyer was worried that, even if his client isn't convicted, his victim would be able to sue him. In the end, the client got away when the prison snitch called by the prosecutor to testify wasn't a reliable witness, forcing a mistrial, but the police decided to investigate his claims that the client had previously raped and killed another girl and framed an innocent man. It turns out to be true and he was convicted for that. Just as planned.
Brought up, with a traditional Wraith Squadron twist, in the X-Wing novelMercy Kill. A Galactic Alliance general is suspected of belonging to a conspiracy to put The Empire back in charge, and the Wraiths are trying to find evidence of his treason. In the process, they find ample evidence of his smuggling and profiteering by selling off Alliance military property (including an Elaborate Underground Base full of contraband), and they consider setting him up to be prosecuted on this charge. However, they decide it would be too easy for him to claim that a junior officer was behind the whole thing, particularly since he recently "retained" the services of a master identity forger. The Wraiths continue to look for evidence before he can undergo a lengthy, but flawless transformation into his new identity. Then Piggy has an epiphany — the general has already undergone the process (so that he can disappear at moment's notice if need be) but is using prosthetics to masquerade as his old self in order to hunt them down. So they gather up a bunch of witnesses and reveal his "true" identity, thereby framing the general for murdering and impersonating... himself.
In After The Golden Age, the supervillain Destructor is ultimately arrested not for any of his attempts to destroy Commerce City, but on charges of fraud, tax evasion, and money laundering.
Live Action TV
Common in the CSI Verse. In one case, someone was cleared of murder during a burglary but discovered to be guilty of Felony Murder.
In another case, the perp initally got away with murder by framing his victim for the sexual assault of his 12 year old daughter. When new evidence proved that the killer was in fact the abuser, he was arrested for the new crime, one which guarantees an automatic life sentence without parole.
In yet another episode, the team can't get enough evidence to press charges against a guy who murdered his wife before the episode is over. However, they assure him it's only the beginning of their investigation. In the mean time, the evidence acquired thus far is enough for the wife's insurance company to want their $750k back and to start repossessing the guy's stuff, starting with his brand new Ferrari.
CSI: Miami had Horatio unable to arrest a murderer because he had diplomatic immunity. However, one of the victims was a Canadian citizen, and Canada did not recognize the guy's diplomatic status. When the guy's yacht ends up in international waters, Horatio alerts the authorities.
Another episode has Horatio figure out that the deaths of two people were caused by toxic genetically modified lettuce but cannot press charges against the company or its smug CEO. However, all the evidence he gathered will make for a massive lawsuit by the victims' families.
In one of the few original CSI: Crime Scene Investigation episodes not involving murder, an exhibit of valuable Japanese historical items is robbed, with the perps making off with several items and millions of dollars in cash from the vault. The team finds out that all the items were fake. The perps, including the supposed owner of the items, a wealthy Japanese businessman, turn out to be employees of the guy hosting the exhibit (the pretender was also Chinese). Grissom confronts him with the evidence, but the guy points out that there's not enough to press charges. Grissom agrees but says he will send the evidence to the guy's insurance company to expose his scam.
This is also a fairly common tactic on Law & Order, as is threatening suspects' friends and acquaintances with accessory charges to get them to testify—or to get the criminal to confess.
For example, an episode of Law & Order: UK has a man get off for manslaughter and drug running after a witness changes his statement. After the trial, Steel has a Eureka Moment and asks his boss to "pull a Capone" on him and get him for tax evasion (which they do).
In a classic Law and Order episode, the show's resident expert psychologist, Dr. Olivet, accused a gynecologist of raping her, but the court was forced to withdraw the charges when the defense attorney claimed that Dr. Olivet had visited the OB-GYN when one of her patients claimed he had raped her, and therefore claimed entrapment. ADA Stone then publicly announced that the city of New York would attempt to prosecute the OB-GYN again. When the doctor gloated that they couldn't touch him for Olivet's rape, Stone revealed that after his public announcement, some fifty-plus former patients stepped forward with rape charges of their own. As Stone then said when discussing a reduced sentence, Stone answered, "In a perfect world, I would leave you in a room with your former patients for an hour. I'll settle for you spending the rest of your life in jail."
The same happens with the UK version of the episode, "Alesha".
An episode in the Ben Stone era featured an African clan leader, whose drug-trafficking resulted in a few deaths and was thus charged with Felony Murder, fleeing to his home country in the middle of his trial, with the cooperation of his country's embassy. When confronted, the ambassador points out that the clan leader has been arrested in his native country, and the New York DA's office has done his country a great favor by bringing forward all that evidence, which could not be gathered in his native land due to his political power, but now that they have absolute proof of his guilt, and they can charge him with drug trafficking, which, unlike New York's Felony Murder law, allows for the death penalty.
Jack McCoy was an expert at coming up with creative "legal theories" usually involving a defendant's actions being legally reinterpreted to make them guilty of a legal statute that wasn't obvious before or coming up with a new theory of the defendant's motive to sidestep some evidentiary hurdle that enabled him to present an open-and-shut case (or threaten to present it in order to force a plea). The most common example was a "Depraved Indifference" murder, where Jack only had to prove the defendant acted recklessly or neglected a legal burden to act in a given situation, even if they were not provably guilty of the actual murder.
There's also a few episodes where McCoy doesn't have enough admissible evidence to convict the accused of what actually happened, so he instead re-presents the evidence based on a version of events that he suspects or even knows is false, but still holds together from a legal standpoint. People would occasionally try to call him out on this, accusing him of essentially lying in court by making bogus claims, but he'd always insist he was only presenting the jury a "theory" which they were free to either agree with or reject.
One of the better ones involves a pair of conspirators who shot a man just for the thrill. Their defense tactic is to have both of them point fingers at the other, only one person actually shot the victim (only one bullet was fired) and the evidence proving conspiracy was thrown out. The jury can't convict them both, and since they're unsure who did it, they would likely acquit both. However, McCoy tricks one of the lawyers into getting the trials severed. The result, both defendants will now face separate trials for the same crime, where attempting to blame their co-conspirator is a defense the jury can choose to believe or not. And given the heinousness of the crime, they probably won't. We don't see it play out though, one of the defendants confesses out of guilt before his case can go to the jury, and his testimony hangs his partner. D.A. Schiff even remarks on how McCoy got the justice system to legally accept a physical impossibility ( Both men fired the same bullet from the same gun ).
Another good example is when the police are in pursuit of a pair of thugs who killed an off-duty cop and kidnapped a limo driver. They catch one of the pair, but with no idea if the limo driver is dead or alive McCoy is forced to give him a very advantageous plea deal (including any "related crimes") in exchange for the whereabouts of the driver. Of course, the driver was already dead and the police later find the guy's partner also dead. McCoy can't get out of the deal, so he charges the living perp with murdering his partner on the slippery theory that the partner's murder was a completely unrelated crime. This leads to the quote at the top of the page, the plea means the original perp essentially walks for killing a cop, but ends up drawing a lengthy prison sentence anyway, for killing his accomplice.
One from a different vector comes about when an OJ Simpson Expy, who had gotten off on the murder of his wife due to a bribed juror, is eventually nailed for the murder of the publisher of a book about the previous trial. McCoy was eventually able to get evidence that the defendant had lied about previous evidence, but also that he admitted killing his wife. The jury convicted him of the current murder, but looking at the jury kind of implied this trope for the previous case.
The Closer, "Good Housekeeping"; a spoiled rich youth, Austin Philips, fled south of the border to avoid prosecution for killing the daughter of a Hispanic immigrant. Knowing she couldn't get him extradited, Brenda went to Mexico to get the full story from him, and he refuses to come back to the US no matter what she tried, even letting Brenda charge his parents, which would cut him off. Brenda asks him for the story so she can close the case, and offers to drop the charges against his parents. The killer, confident he's beyond the reach of American law enforcement, tearfully confesses that he did it by accident, at which point, Brenda reveals that the murdered girl hadn't been born in the U.S., as her mother had claimed. Bad move, confessing that you've killed a Mexican citizen when you just fled to Mexico! The Mexican cops lay hands on him, and Brenda is noticeably disturbed right afterwards, breaking out the booze she bought to bribe the Federales if needed; you don't want to be a white prettyboy in a Mexican prison. More detail here.
In an episode of Ashes to Ashes, Gene Hunt mentions how Al Capone was caught for tax evasion. Inspired by this, the team arrest a troublesome loanshark for outstanding parking tickets.
In the Bones episode "Harbingers In The Fountain" the suspect appears to be getting away with his crime of killing a dozen people and burying them under a fountain. US District Attorney Caroline Julian calls them near the end of the episode to tell them to arrest the man. She has handed the evidence to the DC DA, who is going to prosecute him for fraud. As Caroline notes, "Murder isn't the only crime. It just seems like it around you two."
A Villain of the Week tried to use diplomatic immunity but had a change of mind upon the prospect of dealing with the Mexican Justice instead of the American one.
The District had an example of an interesting legal loophole. An ambassador's son was smuggling drugs in diplomatic bags - specially marked and exempt from searches as part of diplomatic immunity. The cops convince a citizen known for clumsy driving to make a fender-bender on the kid's car, so the contents of the bags in the trunk can be examined. For damage. The traffic cops are admirable: fast, polite and by-the-book. The commissioner is overseeing them personally. While reading from said book. And it's all in the guise of preventing a diplomatic incident. The son has diplomatic immunity (and so can't be charged) because he is still a college student, so the Metro PD have to make their case to the Dean and get him expelled before successfully charging him.
Something of an inversion on Psych. SBPD are going after a known crime lord for tax evasion, and Shawn's illegally obtained evidence threatens to get the whole thing thrown out of court. Shawn redeems himself by convincing several other victims to overcome their fear and testify, meaning the DA can now pursue more serious charges.
On Blue Heelers, Tom goes after a suspected gangster (played by Gary Sweet) in this fashion, even bringing up Al Capone at one point.
JAG: Invoked on at least 3 different occasions when an aviator did something which was clearly the wrong thing to do (e.g. accidently killing Russian peacekeepers in Serbia, unilaterally destroying a U.S. reconnaissance aircraft captured by the Chinese, and intervening in civilian law enforcement in the U.S.), but got acquitted of all significant charges all thanks to having Harmon Rabb as his defense counsel. After the trial, however, the CO informs the aviator that he’s permanently grounded and will undergo extensive medical evaluation. In any case Uncle Sam always wins.
In one episode of The Practice, a man kills his wife. His son, trying to protect him, claims he attacked his dad and the gun went off accidentally. When the man is acquitted, the DA has the son arrested for felony murder. The dad then confesses to the killing but is protected by double jeopardy, so the judge puts them both away for 20 years for perjury.
Smallville: A criminal used diplomatic immunity to evade American justice and ended up nailed by his own country's justice.
"Mr. Monk and the Wrong Man": an ex-con named Max Barton has been exonerated from a conviction for a particularly gruesome double murder, and Monk tries to help him rebuild his life. When the original witness to the crime chides him harshly for helping the very person she insists was the man she saw leaving the crime scene after she heard screaming, Monk suddenly realizes a detail about the crime scene that means Barton was guilty of the original murder all along, but due to double jeopardy, they can't retry him again. However, Monk finds that they can put Barton back in prison for killing the guy who was his partner in the original murder out of fear the guy would talk.
"Mr. Monk Takes the Stand": a sculptor named Evan Gildea is suspected of murdering his wife Nancy and making it look like a break-in. However, when the trial comes up, Gildea's lawyer, the Saul Goodman-esque Harrison Powell, gets the case against his client thrown out by discrediting Monk and Captain Stottlemeyer despite all the evidence suggesting Gildea is guilty. However, Randy then approaches Monk asking him to help exonerate Rudy Smith, a friend of his from a police outreach program who has been accused of robbing an auto parts store and killing a clerk in the process (Rudy has confessed to robbing the clerk and taking her necklace and money from the cashier). In examining the scene, Monk notices evidence that exonerates Rudy of murder, and then he finds a discarded taillight bulb in the bushes next to the store, meaning that while they are unable to put Evan Gildea away for murdering his wife, they can put him away for killing the store clerk.note Monk had noticed when Gildea was driving away from the courthouse after his acquittal, his left taillight looked much newer than his right one, indicating it had recently been replaced. He also had learned from Randy that the M.O. of the clerk's death was identical to Nancy Gildea's death - blunt instrument to the back of the skull causing instant death. When interrogated, Gildea incriminates himself by calling Rudy "a chain-snatching, dope-smoking little thug," only to be told that while Rudy had indeed taken the clerk's necklace, this detail was never in the police report or released to the media.
Edgeworth does this unwittingly in Ace Attorney Investigations. He gets Ernest Amano arrested for helping Lance cover up a murder, to the great delight of Agent Lang. Lang had been previously unable to prove he was tied to a smuggling ring and now had a reason to take him in.
Batman with Robin the Boy Wonder: In one episode, the Joker and his thugs, disguised as a filming crew, were looking for a treasure. It was later revealed the only treasure was a fake. The Joker thought he'd get off because he couldn't be convicted for looking for a false treasure he never found. He was then told he could be nailed for making a film without proper authorization.
In the Christmas Episode of the Animated Adaptation, Ace Ventura couldn't prove Odora stole Santa Claus' reindeers (she intended to use the secret of their gravity-defying abilities on a cosmetic) but could get her arrested for illegally keeping a crocodile from an endangered breed, which she also intended to use as ingredient.
As mentioned above, Al Capone. To elaborate, his sentence of 11 years imprisonment for tax evasionnote Somewhat hilariously, the government couldn't make the case the Capone was a crime kingpin, but they could point to his lifestyle and spending habits and say he was earning money he hadn't paid taxes on. It was pointed out at the time that the government was consciously ignoring how Capone had earned the money (which they couldn't prove) and instead focusing on the fact that he had the money and owed taxes on it was, at the time, the longest sentence ever given for the crime.
Although there is another reason: he usually got a "not guilty" verdict from the jury by having his men bribe or intimidate them. The jury pool for this case was swapped at the last minute, and the trial was started before the jurors could be coerced.
Similarly, there are stories of gangsters who, after managing to finagle out of a trial for murder, were brought up on littering charges after it was later proved they had disposed of bodies in the river.
After being declared not guilty for the murders of Nicole Brown Simpson and Ronald Goldman in 1995 through a combination of incompetence on the part of the authorities and his lawyers making the very public argument he was the victim of racism. He was later sued by the Goldman family in a civil lawsuit, who were awarded damages in excess of 30 million. However, he's paid only a tiny fraction of this. The rights to a failed book deal concerning If I Did It passed to the Goldman family. It was a book in which Simpson presents the scenario of how the murders would have taken place if he had committed the crimes and public outcry ensured it never got publication. In 2007 the Goldman family republished the book with the new name If I Did It: Confessions of the Killer with the "if" so small as to be unnoticeable.
In 2007 Simpson argued that his current conviction and sentence for armed robbery and kidnapping is this for his acquittal for murder. Granted, the possibility was pointed out by the judge, who warned the jury that they could get removed from the bench if they used the murder trial as a prior prejudice. Though the general public thought he was all but convicted the moment he was arrested, it is also unlikely that many have sympathy for him about this. In an interesting contrast to his last trial, many believed he was both poorly defended and the authorities actually did have an agenda this time around.
Jack McCall was found not guilty of murdering Wild Bill Hickock, despite doing it in front of several witnesses. However, the court his trial took place in was set up by a town illegally settled on Indian territory, so it had no authority. This allowed him to be tried again in the Indian territory court, without violation of double jeopardy under the Fifth Amendment of the US Constitution. He was convicted by the jury and sentenced to death. His last words before hanging were in response to a question why he shot Hickock, a famous gunfighter who had out-drawn everyone who ever faced him, in the back: "I wasn't looking to commit suicide."
Most serial killers are not convicted of all crimes they are believed to have committed, or even of all the crimes they claim to have done. For example, it's believed that Ted Bundy or Jeffrey Dahmer, among others, may have killed more people than just the ones they were convicted of.
Similarly, serial killers, rapists and other criminals who commit particularly heinous crimes that make the news have been known to end up being jailed for other offenses without the authorities realizing that they've caught the person who's wanted for the more infamous crimes.
A problem in the Southern US during the heydey of the Ku Klux Klan was that oftentimes a KKK member would be arrested for assaulting or murdering a black man, but would be acquitted despite overwhelming evidence. The reason being that the juries, made up of Southern US citizens, usually contained other KKK members, or people sympathetic to the KKK. So the police then began arresting the KKK members for "infringing on the victim's human rights", which is a Federal crime, and the perpetrator would therefore be tried in a Federal court, whose jurors were not nearly so sympathetic.