Another pet theory I have is that a confounding variable in these studies is often the amount of work someone has to do, and the type of work.
Someone drinking 4+ cups of coffee likely has a reason to be that productive. Which may result in more intellectual stimulation, a higher income, and other differences that makes the two groups very different.
I'd like to see studies where the same individual both drank 4+ cups of coffee everyday for 6 months, and then quit caffeine entirely for 6 months and measure the changes in health, and output collectively but on an individual basis.