It's one of the most known effects of marijuana - you get a powerful surge in appetite (especially a craving for sweets) after smoking (or inhaling or ingesting the drug) - something colloquially referred to as "the munchies".
While for casual users this is a minor and not troubling side effect (often times even enjoyable), for medicinal users who use it to complement chemotherapy, it's a very big advantage, as the therapy causes a lack of appetite. But for years, scientists have struggled to understand how marijuana's active ingredient—tetrahydrocannabinol, or THC—stimulates appetite. Now, they have finally been successful.
A new study published today in Nature Neuroscience showed that, in mice, THC fits into receptors in the brain's olfactory bulb, significantly increasing the animals' ability to smell food and leading them to eat more of it. Basically, it increases appetite by increasing the smell receptors for food - you simply smell and taste the food more accurately. Because scent and taste are so closely related, it likely allows us to better taste flavors as well.
They confirmed this in experiments - when they engineered mice without cannabinoid receptors in their olfactory bulbs, the THC had no effect.
Interestingly enough, this is probably connected to how the plant started producing THC in the first place: it's a defense mechanism against herbivores, so that after eating it, the animals feel disoriented and avoid it in the future, but they do feel hungry and instead focus on other plants.
It's quite likely that what happens in mice happens in humans as well. Previous research has found that the drug also acts on receptors in a region of the brain called the nucleus accumbens, increasing the release of the neurotransmitter dopamine—and the sensation of pleasure—that comes as a result of eating while high.
Edit: The research was carried out by a team led by Giovanni Marsicano of the University of Bordeaux
Journal Reference: The endocannabinoid system controls food intake via olfactory processes. Nature Neuroscience