Ultra-processed foods—the kinds made irresistible by sugar, fat and salt—are ubiquitous in the U.S., making up as much as 60% of the average American diet. But a small, intensive study published in the journal Cell Metabolism shows that their low price and convenience comes at a cost to health.

When people ate a highly processed diet for two weeks, they consumed far more calories and gained more weight and body fat than they did when they ate a less processed diet—even though both diets had the same amounts of nutrients like sugar, fat and sodium.

It wasn’t a shock to find ultra-processed foods weren’t healthy—other research has linked them to a higher risk of cancer and obesity. What was unexpected was that sugar, fat and salt didn’t seem to be what was driving people to overeat. “I was surprised by the results,” says Kevin Hall, lead author of the study and senior investigator at the National Institute of Diabetes and Digestive and Kidney Diseases at the National Institutes of Health. “It’s the first trial that can actually demonstrate that there is a causal relationship between something about ultra-processed foods—independent of those nutrients—that cause people to overeat and gain weight.”

In the study, 20 healthy adults lived for a month in a lab, where all of their meals and snacks were prepared for them. The two meal plans were either highly processed or unprocessed, and everyone ate one—then switched to the other—for two weeks at a time. (Foods like canned ravioli, chicken nuggets, bagels and diet lemonade comprised the ultra-processed diet; the unprocessed diet had salads, scrambled eggs, oatmeal and nuts.)

Both diets contained nearly identical nutrient profiles, with the same amount of sugar, fat, sodium, fiber and more. But the meals had very different effects. When people ate a highly processed diet, they ate about 500 more calories per day than they did on the less-processed diet. They also gained about two pounds over the course of two weeks on the ultra-processed diet—and lost about the same amount on the unprocessed diet.

Want to improve your health? Sign up for TIME’s guide to the healing power of food.

They ate faster, too, which could be one reason why they gained more weight. “Ultra-processed food tends to be softer, which makes it easier to chew and swallow,” Hall says. “One of the theories is that if you’re eating more quickly, you’re not giving your gut enough time to signal to your brain that you’ve had enough calories and that you’re full and to stop eating. By the time the brain gets that signal, it’s too late—you’ve already overeaten.”

People’s hormones also changed depending on how processed their meals were. Even though people said they felt equally full and satisfied on both diets, the unprocessed diet led to an increase in an appetite-suppressing hormone called PYY and a decrease in the hunger hormone ghrelin. “Both of these hormonal changes that took place, for reasons we don’t fully understand, tend to support our observation,” Hall says. On an unprocessed diet, “people spontaneously reduce their calorie intake, leading to weight loss and body fat loss, without them having to count calories or even intentionally do so.”

Avoiding ultra-processed food isn’t easy, especially financially. In the study, the ingredients for the unprocessed meals cost about 40% more than for the ultra-processed foods, Hall says. But the study provides the latest proof that cutting down on processed foods may be worth the extra price and effort.

Write to Mandy Oaklander at mandy.oaklander@time.com.