The law is there, it's an absolute, and it's designed to protect those values of freedom and liberty.
Criminal behaviour is not an absolute, not a constant. It is someone's choice to commit a crime, and they should be punished accordingly. Being sent to prison to 25 years for being stupid enough to be caught shoplifting etc, three times would be a fantastic deterrent.
Unless the crime in question is something like drug possession charges, which is a non-trivial portion of the prison population. Laws about that seem designed to inhibit liberty even if there's no harm to others (or, arguably, to the user).
The law isn't absolute
at all. The legislature, and to an extent the justice system itself define laws. Morphine used to be legal to buy over the counter, now it isn't. It used to be legal to own a person and beat them to death if they made eye contact. Now it isn't. Societies decide what behaviors they want to allow and criminalize those that they want to prohibit.
They use a variety of criteria to determine what falls into which category, but legality is always a matter of decision, not of inherence. For example, 60 years ago interracial marriages were illegal in much of the US. How did that protect freedom? What possible rationale could justify that?
Things that sound like good deterrents aren't necessarily so. The death penalty sounds like a great deterrent, but statistically it has been shown not to be much of one. I couldn't find the full treatment online (I know that there's one in Freakonomics), but
this might be enough to show that I'm not just shooting my mouth off for now. There's been quite a bit of debate about whether or not simply making penalties harsher has much deterrent effect. I won't wade into it now, but there's enough contention that I think it logically hazardous to claim that stricter penalties will necessarily net a worthwhile reduction in crime.
Without sounding like a complete and utter idealist - that's what a welfare system is for.
Spoken by someone whom I can only assume hasn't had much interaction with the welfare system. There has been a steady trend
criminalizing poverty itself for some time. And the welfare system is complicated, inefficient, highly variable by state, and often not able to alleviate circumstances of poverty on its own anyhow.
The justice system itself though is not as harsh as it is painted by the numbers. It is kind of put in a situation where it has no choice but to look harsh because there are just more criminals.
As I mentioned above, the justice system has a huge impact on what people are criminals (even though laws are made by the legislature, they are administered with quite a bit of discretion by courts, and can ultimately be reviewed by the Supreme Court). See above, where I touch on how arbitrarily people can be defined in and out of the "criminal" category. And that doesn't just apply to the raw number of crimes comitted. Sentencing is a huge part of things as well.
Remember just over a year ago, when someone selling crack cocaine would get the same sentence as someone selling 100 times as much poweder cocaine? That's an extremely harsh disparity, and one that is difficult to justify. The new standard is something like an 18:1 ratio for crack to powder. Whether or not that ratio is appropriate can be debated, but it's definitely going to be more definsible than 100:1.
There are a lot of competing factors in how a society will separate criminal from non-criminal acts. The better way is to look at practical matters-- what costs does a crime impart to society, what kinds of measures would be effective in reducing occurrence of those crimes, how much do they cost, etc. It's also easier (or at least possible) to review these to assess the efficacy of the law.
A worse way is to try and use moral standards. They can be difficult to agree on broadly, make assumptions about the benefits to society that are difficult to quantify, and tend to view cost as a secondary concern. Look at prohibition (1920's style). It was expensive, didn't really deliver any benefits to society, couldn't be effectively enforced, and spawned a series of highly undesirable consequences.
Assumptions about criminality or any kind of absolute faith in the justice system are extremely undesirable given these concerns. They make it incredibly difficult to assess the costs and benefits of criminalizing certain behaviors, make it very easy to enforceme moral concepts without being much bothered by data, invite rampant propoganda (whether to compensate for a lack of data or refute it), and make it hard to re-allocate resources when existing practices end up not being very effective. A dollar spent on enforcement or punishment which is not effective is a dollar which can't be spent on something that might be.