From PsychCentral: Food Cravings, Explained:
Results of one study showed that the strength of participants’ cravings was linked to how vividly they imagined the food. […] Studies have shown that when subjects are imagining something, they have a hard time completing various cognitive tasks. In one experiment, volunteers who were craving chocolate recalled fewer words and took longer to solve math problems than volunteers who were not craving chocolate.