Caffeine was found to improve a honeybee's memory and could help the plant recruit more bees to spread its pollen.
The researchers showed through tests that honeybees feeding on a sugar solution containing caffeine, which occurs naturally in the nectar of coffee and citrus flowers, were three times more likely to remember a flower's scent than those feeding on just sugar.
Study leader Dr Geraldine Wright, Reader in Neuroethology at Newcastle University, UK, explained that the effect of caffeine benefits both the honeybee and the plant.
"Remembering floral traits is difficult for bees to perform at a fast pace as they fly from flower to flower and we have found that caffeine helps the bee remember where the flowers are," Wright said.
"In turn, bees that have fed on caffeine-laced nectar are laden with coffee pollen and these bees search for other coffee plants to find more nectar, leading to better pollination."
"So, caffeine in nectar is likely to improve the bee's foraging prowess while providing the plant with a more faithful pollinator," she said.
In the study, researchers found that the nectar of Citrus and Coffea species often contained low doses of caffeine.
They included 'robusta' coffee species mainly used to produce freeze-dried coffee and 'arabica' used for espresso and filter coffee. Grapefruit, lemons, pomelo and oranges were also sampled and all contained caffeine.
Co-author Professor Phil Stevenson from the Royal Botanic Gardens, Kew and the University of Greenwich's Natural Resources Institute, UK, said: "Caffeine is a defence chemical in plants and tastes bitter to many insects including bees so we were surprised to find it in the nectar. However, it occurs at a dose that's too low for the bees to taste but high enough to affect bee behaviour."
The effect of caffeine on the bees' long-term memory was profound with three times as many bees remembering the floral scent 24 hours later and twice as many bees remembering the scent after three days.
Typically, the nectar in the flower of a coffee plant contains almost as much caffeine as a cup of instant coffee.
Just as black coffee has a strong bitter taste to us, high concentrations of caffeine are repellent to honeybees.
Dr Wright added: "This work helps us understand the basic mechanisms of how caffeine affects our brains. What we see in bees could explain why people prefer to drink coffee when studying."
The findings are published in the journal Science.