Justice vs Efficiency: An Example
One way in which a legal system discourages people from doing things that inflict costs on others is by fining them. Roughly speaking, there are two alternative approaches. Under criminal law, the fine goes to the state. Under civil law, it is called a damage payment and goes to the victim.
A variety of arguments can be made for one approach or another; interested readers may want to look at the chapter of my webbed Law's Order devoted to the general question. One interesting feature of the analysis is that the straightforward argument based on justice gives the opposite answer from the straightforward argument based on economic efficiency.
The justice argument is that the money should go to the victim, in order to compensate him for his loss. Indeed, the standard rule in tort law is that the damage owed are enough to "make whole" the victim.
For many, although not all, cases the argument from efficiency goes just the other way. The reason is that, even if the victim is not morally responsible for the loss, in most cases he makes decisions that affect how likely it is to occur and how large it is if it occurs. There is nothing inherently immoral about driving an expensive car, but the more expensive your car is, the larger the damages if my negligent driving results in my running into it. There is nothing inherently immoral about walking after dark in bad neighborhoods, but doing so can substantially increase the chance of being a crime victim.
From the standpoint of economic efficiency--loosely speaking, maximizing the size of the pie--we would like people to reduce the likelihood and cost of their being victims whenever the savings are larger than the cost of doing so. But if victims were fully compensated, as in theory under tort law they are, they would have no incentive at all to take precautions. Hence the efficient rule, for a wide range of cases, is that the money should go to anyone but the victim (or the perpetrator).
[I've linked to the HTML version of a late draft of my book. There is another version that consists of page images of the book as published with virtual footnotes--links to icons in the margin.]