For example, California's 3-strike law counts non-violent felonies, which sweeps up a lot of criminals into 25 year sentences that they don't deserve.
"The California law originally gave judges no discretion in setting prison terms for three strikes offenders. However, the California Supreme Court ruled, in 1996, that judges, in the interest of justice, could ignore prior convictions in determining whether an offender qualified for a three strikes sentence." [1]
But these so called "mandatory" sentences are not actually that, it's just that most judges simply don't have the guts to stand up for justice. A judge can use their discretion in setting sentences, but then can be challenged if Government can show the sentence is unreasonable. While following the guidelines is presumed reasonable, simply not following the guidelines is not presumed unreasonable.
Lois Forer was a judge in Philadelphia facing just such a decision, and he explains the process better than I can [2]. In the end, the man he tried to save was resentenced by another judge to serve the balance of the "mandatory minimum" five years. This is a system which is ultimately perpetuated by the judiciary.
I don't blame the legislature for enacting laws that get them re-elected. I do blame the judges for letting a sentencing law unjustly destroy some peoples lives.
[1] - http://legal-dictionary.thefreedictionary.com/Three+Strikes+... [2] - http://www.thefreelibrary.com/Justice+by+the+numbers%3B+mand...