That is not true for everything. First, laws - not just individual law but the underlying philosphy - varies by country. The continental system is based on the Code Napoleon, where written law gives the spirit, and the courts decide each individual case. What court A, B and C decided in the past 20 years can be taken into account, but is not binding, because circumstances differ between each case. (If there is a trend where judges think the law is not right anymore, they will kick the case upstairs to the constitutational court, which can decide that the law is no longer valid in this form, and hand it over to legislature to fix or get rid of.)
Anglo-American law meanwhile places a lot of weight on previous court’s opinion to interpret the written law.
Second, not all crimes are equal in law. There are severe crimes and lesser crimes. The general attitude of law philosophy is that a crime is not only done against one victim, but it breaks the code and rules of society, and if the perpetrator is not brought to justice, he will do it again, so for the safety of the rest of society, he needs to be caught and put on trial.
However, there are exceptions: college campuses in the US have swept rape under the rug for decades, as have fundie Christian pastors (by not reporting sexual abuse of minors, acting as “counselors” for the men) or the Catholic Church (by reassigning priests who molested children) Some of that was illegal (hence the Boston scandal) some of it are still existing loopholes (not in all US states are counselors required to report on abuse) and therefore not illegal.
Lastly, with minor crimes, the law can give a leeway and say “this is technically illegal, so if the victim wants to sue the perp, we will, but if the victim wants to forget it and reconcile because it’s not worth a big fuss over, we will let it go, too”.
E.g. in my country it is illegal to insult somebody. But the state only automatically prosecutes insults against state officials, cops and soliders. If Joe and Charles are at a bar, both drunk, and call each other names, they can go to the police and sue each other. Or they can say “we were drunk, let’s forget it and stay friends” and then the cops/ state won’t get involved.
Or: theft is illegal. But if somebody steals sth. of very low value and doesn’t seem to suffer from kleptomancy (which needs treatement) or be a habitual thief, but rather a one-time thing - e.g. a teen doing a dare - the owner can decide a stern talking-to is enough warning, and next time the thief will not do it again.