In tests, both overweight and lean volunteers made similar decisions when given food choices in the form of images.
But it was another story when they were offered an all-you-can-eat buffet of real food including sandwiches, desserts, and drinks.
While lean and overweight participants were equally attracted to foods rated as tasty, the latter were more likely to go for the unhealthy, fattening items.
Lead researcher Dr Nenad Medic, from Cambridge University, said: "There's a clear difference between hypothetical food choices that overweight people make and the food they actually eat.
"Even though they know that some foods are less healthy than others and say they wouldn't necessarily choose them, when they are faced with the foods, it's a different matter.
"This is an important insight for health campaigners as it suggests that just trying to educate people about the healthiness of food choices is not enough. The presence of unhealthy food options is likely to override people's decisions.
"In this respect, food choice does not appear to be a rational decision - it can become divorced from what the person knows and values."
For the study the researchers recruited 23 lean and 40 overweight individuals, who were first asked to rate 50 common snack foods presented on a computer screen.
They were told to score each item on a five-point scale for healthiness and tastiness.
Every participant was then asked to swap a "neutral" food item for another food item from the list of images.
Body weight had no bearing on the decisions made during this task, and scans showed no difference in brain activity between lean and overweight volunteers.
In the "buffet" experiment, the healthy food items were paired with unhealthy alternatives. For instance, one choice was between a "healthy" chicken or "unhealthy" BLT (bacon, lettuce and tomato) sandwich.
Overweight participants consumed comparably more unhealthy foods than lean participants.
As well as being overweight, impulsivity was associated with unhealthy food choices from the buffet. The more impulsive participants were, the more they were likely to pick the unhealthy items.
• The findings are published in the journal eNeuro.