Well, one, it's magic so maybe it cancels out caffeine. And two, caffeine can affect people differently. It is a melatonin inhibitor universally, but for instance for those who actually have ADHD and aren't just distracted a lot, caffeine and other stimulants help them focus rather than just making them jittery or energetic.
But mostly, it's magic and the author is probably just careless.

I get stories don't gotta follow real life concepts exactly but it lowkey irks me the fact that she's making him coffee in order to make him sleep like guys!! does caffeine in coffee just not exist hello?? 14 chaps in and the ml is having coffee in the ass crack of night ike what, idk just my thoughts tho ╮( ̄▽ ̄)╭