"Don't go shopping when you're hungry and you don't have a list, because you're just going to buy all sorts of junk food," advised Yaroch, who wasn't involved in the new study.

She said the results may have implications not just for everyday shoppers, but for "food insecure" families, which often don't have the money to buy healthy food -- or any food.

For their research, Aner Tal and Brian Wansink from Cornell University in Ithaca, N.Y., conducted a lab study and went out into "the field" to see how hunger influenced food choices.

For the lab study, they asked 68 adults not to eat for the five hours before a late-afternoon appointment. Prior to starting the experiment, the researchers gave half of the participants a plate of Wheat Thins to sate their hunger. Then they had all study subjects shop in a simulated online grocery store.

On average, both hungry and sated participants bought eight low-calorie food items, which included certain types of dairy products, meats and snacks.

The hungry participants also bought six higher-calorie items, compared to four purchased by people who'd recently had a snack, according to the findings published Monday in JAMA Internal Medicine.

Likewise in their field study, the researchers observed 82 people's purchases in a real supermarket and found the ratio of high-calorie foods to low-calorie foods was healthier between 1 p.m. and 4 p.m. than between 4 p.m. and 7 p.m.

Endocrinologist Tony Goldstone from Imperial College London said the findings should be interpreted cautiously given the assumptions the authors made that people would be hungrier during the later time period.

Still, he told Reuters Health, "It overall is pointing to what we expected."

That behavior might stem from an evolutionary time when it was essential for a person to find high-calorie food after a long fast, Tal speculated.

Goldstone agreed.

"The body is always trying to defend its state and it makes very logical sense that if you're going for a period without food, and you're wanting food, you're more likely to go for the food that's high-calorie," he said. "If we're needing energy, we're not going to go out for lettuce."

Tal recommended that people have a snack, such as a piece of fruit, before going grocery shopping or chew gum while perusing the aisles to mitigate the effects of hunger.

"Do your shopping at hours when you're less vulnerable, like after lunch versus before lunch, and so on," he told Reuters Health.

Yaroch said that for people who can't always afford food, the new study shows there may be biological cues as well as practical ones pointing them toward the junk food aisle.

"It's not surprising to me that when you're hungry, you're going to choose foods of low nutritional quality," she told Reuters Health. "What's disturbing to me is I feel that people don't understand the connection between obesity and food insecurity."

Not knowing when you're going to have food available means that when you do, you're going to choose a high-calorie option, Yaroch said -- especially when it's the cheapest one.

"There are definitely different implications for someone who's hungry most of the time," she said.