It has been hypothesized, as per Game Theoretical models, that evolution of cooperation is contingent on there being people willing to inflict punishment on the cheaters/ free loafers , even at great cost to themselves. The presence of Altruism/ co-operation in human social groups suggests that the desire to inflict punishment has been selected for and is thus a part of humans nature.
In the psychological analysis of law, it has been debated for some time as to why all human societies punish their 'criminals'. The two opposing views are that punishment is a deliberative , rational action whose purpose is to deter other potential criminals; and that punishment is an emotional action due to moral outrage and accompanied with feelings of 'just desserts' and desire for justice or fairness.
Do You Mind blog has a great post reviewing a study by Carlsmith, Darley & Robinson (2002), in which they try to find why people punish- is it to deter; or is it due to moral outrage and to get even.
The hypothesis was that if punishment is for deterrence, it would be more severe for crimes that are rarely detected (to compensate for the fact that the crime is rare, the punishment should be high); also for high publicity crimes, the punishment should be high (as the crime draws more attention, thereby punishing it severely will deter more people and from other crimes too). also if the punishment was motivated by desire for revenge/ justice, the severity of punishment should be correlated with severity of crime and publicity or detection of crime should have no effect. Also extenuating circumstances should excuse people if the desire is for justice/ fairness.
Accordingly, the authors set out to test how much of an influence deterrence really had. To do so, they designed a series of experiments using narratives of crimes where the above attributes (detection rate, publicity, magnitude of harm and extenuating circumstances) were varied. They found that manipulation of the deterrence variables had no effect, but that increasing the magnitude of harm or decreasing the extenuating circumstances greatly influenced the severity of punishment, even for those subjects who explicitly stated their preference for deterrence over "just deserts" theories of punishment.
This is an important validation of the fact that people do punish and that it is due to emotional and moral outrage and not based on coll and rational thinking based on deterrence. Thus, it seems for evolution of co-operation, we have been hard-wired to detect cheaters and to punish them and this is done without analytical deliberation but automatically.
Another article in the New Scientist , takes this one step forward and looks at motivations and mechanisms behind why we punish. The researcher, Terry Burnahm, asks the question as to why people indulge in a punishment behavior, though the punishment comes with a cost to themselves. Is it driven by a moral sense outrage, a desire for fairness or due to some other biological mechanism. The paradigm they use is the ultimatum game, wherein one person is given some money (say 10 $) and he is supposed to share it with another person. If the second person accepts the money, both get to keep the money; else both lose their money. Experimentally it is found that if low offers are made (say 1 $), they are usually rejected by the second person. This is due to the fact that the second personal wants to punish the first person for making an unfair offer.
What Terry discovered was that the propensity to refuse low offers was correlated with testosterone levels in males. Testosterone levels have also been correlated with aggression in the past and with dominance seeking behavior. The author suggests that the high testosterone connection is due to dominance seeking behavior of humans and by refusing to accept the low bet, the male saves putting himself in a subordinate position. It is presumed that this was beneficial in evolutionary times and thus has been selected for.
An alternative hypothesis can be that though the desire for revenge, just desserts or fairness is present in all humans, the ability to act on that desire is correlated with the aggression level or the level of testosterone. If this is the case, then the high levels of testosterone in males who retributed could be due to their moral outrage and their aggressiveness enabling them to act on their moral outrage. thus, in my view, the study , though finding a biological correlate, does not negate the scope for moral outrage, as increasingly it has come to be recognized that morality itself is emotional and more instinct like and not deliberative.