When a group of self-interested individuals has selfish interest in seeing that instances of selfishness get punished. An individual displaying selfish behavior will be punished those whose self-interest is negatively affected by his selfish behavior.
“Yet these phenomena are rare. What stops the mutiny? Why do segregation distorters, B chromosomes and cancer cells not succeed in winning the contest? Why does harmony generally prevail over selfishness? Because the organism, the coagulation, asserts its greater interest. But what is the organism? There is no such thing. It is merely the sum of the selfish parts;; and a group of units selected to be selfish cannot surely turn altruistic.
The resolution of this paradox takes us back to the honey bees. Each worker bee has a selfish inter in producing drones; but each worker equally has a selfish interests that no other worker produce drones. For every self drone-producer there are thousands of bees with a selfish interest in preventing drone production. So a bee hive is not, as Shakespeare thought, a despotism, run from above. It is a democracy, in which the individual wishes of the many prevail over the egoism of each” (33, The Origins of Virtue)
The Origins of Virtue by Matt Ridley