Ryan McVay / Getty

After knocking on every door on the block on Halloween night, many children come home and promptly set up what looks unmistakably like a bargaining table. In the hours before bedtime, an elementary kind of commerce ensues: Reese’s Peanut Butter Cups and full-size Butterfingers will either be hoarded in the face of generous offers or traded at a steep exchange rate for Skittles or Starbursts. Off-brand Smarties will likely be offloaded into the plastic pumpkin-shaped buckets of unsuspecting toddlers, replacing the Sour Patch Kids, which their devious older siblings have convinced them are inferior.

But like every business transaction, the success of a candy exchange can be influenced by interpersonal dynamics, power imbalances, and persuasion skills—in other words, a candy exchange among kids is a more delicate and complex affair than it may seem to the average grown-up eye.

The obvious reason to trade Halloween treats is that kids love candy—and maximizing the amount of the types of candy they love best is an appealing prospect. Plus, in the best-case scenario, a trade is a win-win: You not only get rid of something you don’t want to eat—the candy that will sit at the bottom of your trick-or-treat bag until it eventually gets thrown out—but you also gain something that you do want to eat in return.

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.

Still, Yeh sees some similarities between Pokémon trading and candy trading. One constant is that older kids tend to take advantage of younger ones, resulting in what she calls “trader’s remorse.” “Younger kids will give in [to bad trades] because they’re enjoying the interaction,” Yeh said. “But then after the interaction is over, they’re like, Wait!

Of course, Yeh noted, not every younger kid is susceptible to the schemes of older kids, and not every older kid is out for all the Mike and Ikes he can swindle. Trades between kids, she pointed out, are also influenced by the personalities of the individuals involved. Some kids are predisposed toward being protective of their things, which can result in more aggressive trades, or a lot of back-and-forth in the negotiation process.

Kids do have an “understanding of how to work a deal,” she said. “‘I’ll give you these two. No? Okay, how about three? How about four?’ And then you’ll have kids who are like, ‘Well, you can’t have my Kit Kat. But I’ll give you my Snickers!’ And the other party then has to reevaluate: ‘Well, if I can't get the Kit Kat, are these five candies worth the Snickers bar?’”

But some kids, Yeh has noticed, seem to just want to make everybody as happy as possible with their lot, and they often don’t mind sacrificing their own best outcomes for the benefit of their friends. A kid like that, she said, might give his one bag of candy corn to his friend who loves candy corn, even though he himself also prefers it over other candies. “Some kids have that prosocial kind of mind-set, where they’re just like, ‘If I can help out a friend, I’m going to.’ They prefer to make their friend happy,” she said.

There will always be children who want to hoard their preferred lots, though. The kindest, fairest Halloween-candy market, Yeh suggested, is likely one where the traders value different candies differently. “It is always lovely when you have friends who have complementary tastes.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.