When legislators write laws or the penal code, their only concern is deterrence, though standards of condemnation can also be codified, such as in three-strikes laws.
Let’s consider for the sake of simplicity property crimes, like theft. If detection of crimes and capturing criminals on the lam were 100% efficient, then punishments would be entirely superfluous, and restitution alone would serve to deter. What is the point of stealing if you are inevitably found out, caught, and forced to return the money? If no one could profit from his own wrong, then no one would try to do wrong.
But of course detection and capturing criminals are very imperfect and expensive. With only restitution, a guy would think: “There is a 50% chance that I get caught and the same chance that I get away. If I get caught, all I’ll have do is return the money; if not, I get to keep the loot. I like those odds.” But if in addition he were threatened with a year in prison if he got caught, then perhaps he would change his mind.
The law is general and people may be positioned differently regarding their odds of getting caught, so it’s an imperfect solution. But in a trial, there are tools to help: for example, trying to conceal wrongdoing can result in a harsher punishment both for the sake of deterring crimes marked by a lower probability of detection and to spare society the cost of administering justice, such as investigations of crimes.
Punishments then over and above restitutions are stipulated in order to compensate for the imperfect and costly system of justice. As we can see, the act of the legislator promulgating punishments for a crime in general is very different from the act of a judge imposing a sentence for the same crime in its full concrete particularity.
The legislator cares only to repair the defects of the real-world pure restitution regime which nevertheless serves as an ideal.
For the judge, however, this purpose is nugatory. If the law demands a punishment of no more than 3 years in prison for stealing a car, the judge needs to decide whether punishment is appropriate and if so, then how much, of what kind, and which of our four theories described below is to be invoked in its formulation. Thus, if his sentence is to take away the criminal’s own car and his driver’s license, say, we can say this is a sophisticated attempt at rehabilitation: let the thief fully feel what it was like for his victim to suffer.