Imagine this: two defendants, same age, smoke a joint with some friends one July evening in their respective apartments. Neither has a criminal record. Both get caught; one faces an extra two years in jail.

Why? Because he shared drugs within a certain number of feet from a school that’s been out for a month.

The so-called ‘Drug Free School Zone’ is one of many laws that create extra penalties for already illegal acts with no reasonable tie to the public’s safety or the defendant’s particular circumstances.

It hasn’t always been like this. Historically, U.S. law and custom have provided robust protections for defendants. Four amendments in the Bill of Rights directly address rights during criminal investigations. Until the 1800s, juries not only determined facts of law—that is, whether the law was broken—but whether the law in question was just in the first place.

Unfortunately, these principles have eroded over time, particularly in recent decades. Congress and many states have legislated harsher, blanket punishments for crimes considered public priorities, regardless of what a judge or jury might deem appropriate. Many times, these laws are passed with the best of intentions, often in response to tragedies involving young children. But they handicap judges and juries, making it impossible for them to determine whether or not a legislated punishment is reasonable given the facts of the case. Moreover, harsh automatic punishments give prosecutors more leverage to extract plea bargains from defendants, because a judge, upon conviction, will be obligated to inflict a harsh penalty no matter what sentence he thinks the defendant deserves.

In a nutshell, these laws instruct our criminal justice system, “For the sake of the children, don’t think!”

Take, for example, Drug Free School Zones. In all 50 states, selling, manufacturing, and sometimes just possessing illicit drugs within a specified distance of a school, park, or daycare center may trigger a higher punishment for the underlying drug offense. Some statutes are written so broadly that huge swaths of major cities—often black or Hispanic neighborhoods with high population densities—are covered by overlapping Drug Free School Zones, negating any deterrent effect and skewing enforcement against minority communities. These penalties are applied whether or not children are involved, and even if the school is out of session.

Sex offender registries are also problematic. Taking a hard line against child predators by limiting their access to children seems perfectly reasonable. But not all sex offenders are child predators. Some individuals on the registry were prosecuted years ago at 17 or 18 for having consensual sex with their 15- or 16-year-old significant other. Even so, the law significantly limits where they can live their lives. The statutes might prevent a father from attending a daughter’s recital at her school because he was convicted of public urination after too many drinks and a long line at a concert in college.

The War on Drugs gave rise to punitive sanctions targeted at cartels and gang leaders. Ramped-up, “mandatory minimum” sentencing for weight-based drug statutes were sold as weapons against kingpins. But most often, these sentences are imposed upon low-level dealers and “mules.”

These broad statutes create a system that can’t distinguish grown men from schoolchildren, serial rapists from amorous teens, or drug mules from kingpins. Such a system is dysfunctional — stupid even.

Thankfully, state and federal policymakers are beginning to recognize this. Because stupid policy can get awfully expensive.

According to the Sentencing Project, several states, including Indiana, New Jersey, Kentucky, South Carolina, Delaware, and Connecticut, have reduced the scope and breadth of their Drug Free School Zones. Some lowered the geographical reach, others eliminated or greatly reduced mandatory minimum sentence enhancements, and still others made the offenses at least tangentially tied to exposing children to the drug trade.

The Senate is considering the Smarter Sentencing Act, introduced by Sen. Mike Lee (R-Utah) and Richard Durbin (D-Ill.). This bill would reduce some mandatory minimum sentences for non-violent drug offenders, and allow many already incarcerated under the old guidelines to apply for sentence reductions

In a similar vein, the U.S. Sentencing Commission will decide whether to make recent two-level sentence reductions for all non-violent drug offenses (effective November 1, 2014) retroactively applicable to all relevant federal prisoners. More than 50,000 current federal prisoners may be eligible, potentially saving hundreds of millions of dollars or more.

The stupid laws and rules promulgated over decades of “tough on crime” rhetoric will take years to reform and correct. Throwing the book at offenders with well-meant but misguided lawmaking has wreaked havoc on correctional budgets while breaking up families and damaging local economies in the process. Policymakers who are now reevaluating laws and extending review to thousands of inmates subjected to blind punishment would do even better than the reforms above to let judges decide who is punished and how severely in the first place. Certainly such a system would be imperfect as well, but mistakes made in individual cases would harm far fewer people than those subjected to inflexible categorical judgment of legislators and prosecutors.