Involved in the biosynthesis of caffeine (PubMed:16333668, PubMed:30303011). Catalyzes the conversion of 7-methylxanthine (7mX) to theobromine, and, to some extent, the conversion of paraxanthine to caffeine, but seems not able to convert theobromine to caffeine (PubMed:16333668, PubMed:30303011). 1,7-dimethylxanthine + S-adenosyl-L-methionine = caffeine + H(+) + S-adenosyl-L-homocysteine 7-methylxanthine + S-adenosyl-L-methionine = H(+) + S-adenosyl-L-homocysteine + theobromine Binds 1 Mg(2+) ion per subunit. Optimum pH is 8.0-8.5. Alkaloid biosynthesis. Belongs to the methyltransferase superfamily. Type-7 methyltransferase family.