As a thought experiment (I'm completely making up these claims, but they do at least seem plausible), imagine a world in which regular coffee consumption resulted in some small increase in cancer risk, but then also regular coffee consumption was correlated with say, academic success, success at work, had some appetite suppressing effects, etc.
If the latter outweighs the former then the cancer risk is probably worth it even just longevity wise. Like how we know that going out in the sun increases cancer risk but also is just, well, good for us, to a degree.
But of course the media will just run with a headline, which is why it sometimes feels as if the science is constantly "changing".