I'm still spitballing here, but I speculate it's because caffeine increases calorie consumption*, reducing diabetes risk. Diabetes is a major risk factor for dementia.
*calorie expenditure
Excuse the basic question- is that a typo, or do you really mean that higher calorie intake reduces diabetes risk?
If that is correct, why?
I thought higher calorie intake leads to weight gain which increases diabetes risk.
Another possibility: Coffee intake is a proxy measurement for bitter taste tolerance, as many people take theirs without sugar. As healthy vegetables and low sugar foodstuff tend to be bitter, coffee and healthy food may be correlated to some measure.