Playing fair is an altruistic behavior - we sacrifice our own potential gain to give others what they deserve.  It's persisted since man has existed, so is it biological or social?

Regardless, it's still nice. No one is against fairness except people who have earned less of something and think others should reward them for it. And it may not even be altruistic. Northeastern University assistant professor of philosophy Rory Smead suggests another, darker origin behind fairness.  Spite.

It’s unclear why any seemingly pointless behavior sticks around. 'Spite' is characterized as paying a cost to harm another - it yields virtually no positive outcome for the perpetrator - so in a world of evolutionary psychology, where all biology has function and all behavior is biological, why would spite persist? 

Smead and Patrick Forber of Tufts University created a modification of The Ultimatum Game, which is used as a means of studying social behavior. 

In an ultimatum game, one player proposes a division of resources the other player can either accept or reject. Suppose each interaction concerns the distribution of 10 one-dollar bills. The first player could suggest that he take $5 for himself and give the remaining $5 to the second player. That would be fair. However, that first player could also go for an unfair option in which he keeps $9 for himself and gives just $1 to the second player.

While the second player is worse off if he rejects the proposal (he gets nothing instead of $1), he almost always does so in real-world versions of the game: because it's not fair.

The scholars decided to simulate the game mathematically to see how it would play out, they found that in fact the exact opposite happens. Fairness usually gets flushed out of the system since it’s more beneficial for both the first player (the proposer) to suggest unfair offers and for the second player (the responder) to accept them. 

“Evolutionary models don’t match what we’re observing in real life,” Smead said, so they  considered that the ultimatum game is actually quite unlike the real world - though few outside sociologists and psychologists writing papers about it ever claimed it was, that is why it's called a model.

Northeastern assistant professor of philosophy Rory Smead Photo by Mary Knox Merrill. Link: Northeastern

Obviously people are not limited to two outcomes outside a game that has rules where there can only be two ways that two individuals could act. The researchers couldn’t, for obvious reasons, make the game as complex and nuanced as real world social interactions, but they could instead just add a little more nuance to it and see what happened.

So that’s what they did.

In their version of the ultimatum game, they introduced “negative assortment.” Think of assortment as the likelihood that a person you’re interacting with is similar to you. In negative assortment, that likelihood is low, so in the ultimatum game the players would likely use different strategies.

That’s where spite comes back into play.

If you and I both commit to just making fair offers, but my strategy is to accept all offers—be they fair or unfair—and yours is to accept only fair ones, we are different. A spiteful strategy would be to both make only unfair offers, but reject such offers when they come from the other person. In the original version of the ultimatum game, a spiteful player will usually walk away with nothing and forfeit the game. But with negative assortment, spite becomes common and actually ends up promoting fairness.

“Acting fairly protects you from spite,” Smead explained. Think of it this way. A “gamesman” is someone who only makes unfair offers to benefit himself but accepts whatever comes his way because he believes it’ll all wash out in the end. “Gamesmen become a target for spite because they’re making unfair offers,” Smead said.

The “spiters” will reject those offers, eventually killing off the gamesmen. But fair players will now do quite well in the presence of spite. Since they don’t make unfair offers, they don’t risk being rejected by the spiteful players. Fairness actually becomes a strategy for survival in this land of spite. “Real social life is complicated,” Smead said. 

Citation: Patrick Forber, Rory Smead, 'The evolution of fairness through spite', Proc. R. Soc. B April 7, 2014 281 1780 20132439; 1471-2954 doi: 10.1098/rspb.2013.2439