The most lucrative option, of course, was to keep the whole prize and stiff the anonymous partner. But the Missourians on average shared more than 45 percent of the prize, and some other societies were nearly as generous, like the Ghanians living in the city of Accra and the Sanquianga fishermen on the coast of Colombia.

But most of the hunter-gatherers, foragers and subsistence farmers were less inclined to share. The Hadza nomads in the Serengeti and the Tsimane Indians in the Amazon gave away only a quarter of the prize. They also reacted differently when given a chance, in variations of the game, to punish another player for hogging the prize.

Selfishness offended the Missourians so much that they would punish the player even though it cost them money. But the members of traditional societies showed little inclination to punish others at their own expense. “There are lots of norms in these small-scale societies for how to treat one another and share food,” says Dr. Henrich. “But these rules don’t apply in unusual situations when you don’t know anything about the kinship or status of the other person. You don’t feel the same sense of responsibility, and you act more out of self-interest.”

The researchers found that people in small communities like the Hadza camp (population about 50) were less willing to inflict punishment than people in larger communities like Hamilton (about 1,800). That makes practical sense: the more strangers there are, the more need to keep them from exploiting one another. But what enabled those larger societies to grow in the first place?

Dr. Henrich and his colleagues identified two distinguishing factors.

People belonging to a modern “world religion,” like the Islamic faith of the Orma cattle herders in Kenya or the Christian faith of the Dolgan reindeer herders in Siberia, tended to share more of their prize than did adherents of local religions. As larger communities became possible after the invention of agriculture, the researchers write in Science, “intersocietal competition may have favored those religious systems that galvanize pro-social behavior in broader communities, perhaps using both supernatural incentives (for example, hell) and recurrent rituals that intensify group solidarity.”

But a second factor seemed even more important. In explaining attitudes toward fairness, Dr. Henrich and his colleagues found that the strongest predictor was the community’s level of “market integration,” which was measured by the percentage of the diet that was purchased. The people who got all or most of their food by hunting, fishing, foraging or growing it themselves were less inclined to share a prize equally.