Read: Trick-or-treating isn’t what it used to be

Experts, however, suggest that a few other forces drive the Halloween-candy trade. For example, Felix Warneken, a psychology professor at the University of Michigan whose research focuses on cooperation among young children, sees in the candy trade an expression of small children’s tendency to impulsively help others. “Toddlers as young as 14 or 18 months of age, when they witness that someone has a practical problem—someone’s looking for something, they don’t know how to open a box, an object is out of reach, a door is closed and they can’t get through it—kids spontaneously help out,” Warneken told us. If the opportunity appears to give peers the candy they most want to eat, kids are likely to want to take it.

Marie Yeh, an associate professor of marketing at Loyola University at Maryland who has researched bargaining processes among children, sees candy trading as an appealingly sophisticated activity that younger kids often want to be included in alongside their older siblings. “Younger children want to interact with the older children. They want them to play with them; they want their attention,” Yeh told us. Trading candy with the big kids could satisfy little kids’ desire to feel included. As for the older kids, they would likely trade as a fun social activity anyway, but including the younger kids could mean they get more of their favorite candy.

The age of the participants in a candy trade can affect whether those trades are truly fair. Warneken cited research indicating that kids learn a couple of negotiating skills around the age of 6: not to make deals with people who can’t or won’t give them anything in return, and that it’s only fair to evenly share rewards with someone who has done equal work to get those rewards.

“Young kids have trouble,” Warneken said. “But by 5, 6 years of age, they begin to be more likely to give to the trustworthy individual, over [the] untrustworthy individual. This shows that between 4 and 6 years of age, [kids] develop the ability to engage in these economic exchanges that require economic trust.” Without these skills, 3- and 4-year-olds are likely to get the short end of the stick sometimes (or perhaps, in this scenario, the box of raisins).

Halloween-candy bartering markets, it’s important to note, don’t necessarily have fixed value systems; kids trade for what’s most valuable to them personally rather than what’s most valuable objectively. So in some ways, it’s easier to come by a win-win outcome in a Halloween-candy trade (perhaps one child hates Skittles but loves M&Ms, and her friend hates M&Ms but loves Skittles) than it might be in, say, a Pokémon-card trade. Yeh once conducted a study in which she observed kids’ Pokémon-trading habits, and she noted that scarcity is built into the system in the form of rare or specialty cards, and everyone who’s old enough to understand how the game of Pokémon works agrees on which cards are most desirable.