So what? They clearly believe the marketing helps them make more revenue with the drug; that has nothing to do with covering the cost of R&D.
Your argument would make sense if marketing reduced their ROI, but they clearly believe it does the opposite.
I'm sure developers in San Francisco spend more on housing than on professional/personal development, but that doesn't mean one is precluding the other.
It's only "excess cash" if you assume the ROI on marketing is negative, which is a bold and unsubstantiated claim.
> Also in countries where there’s a public system pharma usually has 0 advertising because people have no choice anyway.
Direct-to-consumer advertising is only one tiny portion of marketing. European pharmaceutical companies spend massive amounts of money on marketing within Europe.
But here's one with unrestricted access [1]: big pharma spends in average 17% of their revenue on R&D, while Apple spends 3%.
[1] https://www.investopedia.com/ask/answers/060115/how-much-dru...
Edit Here's another link that states the average for Big Pharma for 2018 was 20%
[2] https://www.fiercebiotech.com/special-report/top-10-pharma-r...
https://www.washingtonpost.com/news/wonk/wp/2015/02/11/big-p...