Consumers love freebies. But the companies handing out complimentary donuts, comic books, ice cream, pancakes, and Slurpees love giveaways even more. On the surface, freebies look like obvious money losers. But when handled wisely, giveaways are all but guaranteed to boost sales.

Last week, Procter & Gamble hosted an enormous giveaway in New York City. Throughout Manhattan, company representatives handed out more than 40,000 products from P&G brands such as Gillette, Duracell, Scope, Febreze, Pampers, and Cover Girl. Simply getting these products into the hands of consumers is something of a success: After all, every person who tries out one of these products has the potential of becoming a lifelong customer.

But the power of giveaways goes much deeper. When consumers get something for nothing, they respond in a host of surprising, mostly unconscious ways — and the net result is often that the companies handing out freebies are rewarded well for their “generosity.” Here are a few of the surprising ways consumers are affected by freebies:

You feel obligated to buy more. Marketers notice it over and over: Promotional events like Free Comic Book Day are huge moneymakers, even though logic would seem to dictate that retailers would lose money. The reason for this is what marketers call the reciprocity principle. In a much-cited 2005 study, Randy Garner, a professor of behavioral science at Sam Houston State University, wrote that feeling obligated to reciprocate a favor “can occur despite the fact that we may never have requested the favor in the first place.”

Logic dictates that giveaways like 7-Eleven’s Free Slurpee Day, when customers can get a free 7.11-ounce Slurpee, no strings attached, should cost the company money: People come in, get their freebie and walk out. But what actually happens is that a lot of people walk in, try the sample size and then decide to buy a bigger Slurpee that’s not part of the giveaway. According to USA Today, Slurpee sales shot up 38% on Free Slurpee Day even though the chain gave away 4.5 million of the drinks. Likewise, free samples at supermarkets help boost sales at least partially because customers who’ve been given a taste tend to feel obligated to buy the food they’ve been given for free.

When given something for free, you’ll pay more for it later. If an item comes with an inexpensive price tag, we assume it’s cheap quality and isn’t worth good money. But according to a new study forthcoming in the Journal of Consumer Research, if an item is thrown in as a bonus freebie when buying an expensive or luxury good, consumers deem the freebie as a higher quality product and are willing to pay more for the item on its own.

This might seem a little screwy. If we view something deeply discounted as having a low value, why would we assign a higher value on it when it costs us nothing? The answer has to do with the different ways we process information. It’s easy to assign a dollar value to an item that already has a price; researchers call it a “natural anchor.” But without a price as a cue, we tend to get confused, and our brain starts looking for other signs to indicate value. Researchers say if the primary item (the one you’re paying for) is something high-end and pricey like a luxury car, then the buyer assumes that the “free” like a GPS is high quality as well.

You perceive getting more as superior to a discount. In experiments conducted for a Journal of Marketing study, participants had a choice of getting 33% more coffee or 33% off the regular price of coffee. More people picked the former, even though the discount is a better deal in terms of how much the coffee costs per ounce.

The problem appears to be that we’re really bad at math when it comes to calculating percentages. Researchers found that people thought a 33% increase in quantity and a 33% percent discount were equivalent; in fact, the discount is equal to getting 50% more in terms of unit price.

Once shoppers ignore or miscalculate the numbers, they’re left with emotional factors to guide their decision-making. People perceive getting something free or extra as a gain, while a discount is viewed as just reducing the loss paid out of pocket. We’d rather gain than lose, even when it’s not in our best interest economically.

You’ll buy more when there’s a mystery involved. In a new study in the Journal of Marketing, researchers from the University of Miami found that offering a free gift-with-purchase without specifying what the item is prompts people to buy — if they’re buying fun stuff. Researchers point to high-end makeup and perfume purchases, both of which use a lot of “free gift” promotions and which are what researchers call “affective” — that is, buying it makes you happy or feel good about yourself. For these kinds of things, optimism about a surprise can prompt people to buy.

When our purchase decisions are based on emotion, retailers even can get away with smaller or fewer freebies, just as long as there’s a surprise involved. “Uncertainty may have a stronger impact than simply offering more to consumers. Indeed, when offering more decreases uncertainty, the strategy may backfire because consumers may perceive the promotion to be less fun,” researchers write.

You’ll talk more about freebies. The rise of social media has more companies concerned with “word of mouth” marketing and reputation. Getting your customers to say nice things about you is, according to some research, as effective as traditional advertising, and it’s almost always cheaper. And companies like Procter & Gamble are figuring that one of the easiest and best ways to get people talking about their products is to simply give them away. An article in the Journal of Marketing found that people who got a product for free talked about it 20% more. Getting a freebie related to the product prompted them to talk about it 15% more, while coupons and rebates didn’t make a difference.