The marketing may be effective and still unnecessary. For example, consider a simified world model where drug A and drug B are identical, and are the two widely known solutions to a given condition. In a world where no marketing is done, people with the condition will randomly buy A or B, with roughly a 50% chance of either outcome, assuming they cost the same amount. In a world where A spends half their revenue on marketing, people start buying A more than B. If B responds by also spending $50 on marketing, we go back to the world where each is purchased roughly equally, but now the marketing budget has to come out of the pocket of either the company owners or drug purchasers.
If you pass a law banning drug marketing, you may be able to get the same health outcomes with less overhead. Of course, this ignores all the hypothetical cases where marketing helps, like increasing awareness of a beneficial treatment that was not previously well known.