This blog is not going to actually read Caffeine in your drink: natural or synthetic? by Lijun Zhang et al. (DOI). They imagine health issues with bad synthetic versus good natural caffeine and came up with a crazy over-the-top analytical tool ( high-temperature reversed-phase liquid chromatography / isotope ratio mass spectrometry if you need to know) to detect synthetic caffeine. According to Rajendrani Mukhopadhyay in C&EN it is against the law in some countries to replace natural with synthetic without mentioning it on the label.
And what is so bad about this synthetic caffeine anyway. Compared to sourcing from coffee beans it is cheaper to manufacture, does not involve slave labour, is eco-friendly, does not require pesticides and quality control is easier.
But how is synthetic caffeine made? Wikipedia for some reason denies it exists. Thanks to a Ruhr University Bochum lab handout we have a clue. One method was invented by Wilhelm Traube already in 1900. Starting materials are dimethylurea and cyanoacetic acid. Reaction steps are acylation, then ring-closing with a Pinner reaction variation, then nitrosation (nitric acid), then reduction (sodium dithionite), then another ring-closing with formamide to theophylline and finally alkylation with iodomethane and a base. Modern industrial methods are adaptations. So remember next time at Starbucks: demand synthetic!