Overcharging does confer an advantage on the prosecution, specifically, it enhances the prosecutor's position in plea bargaining, allowing the prosecutor to "compromise" while still getting the actual conviction sought.
There is also a more tangible issue. If a prosecutor brings a charge that carries the death penalty as a potential sentence, the jury that will be selected in the case is "death qualified". This means that people who are morally opposed to the death penalty are excluded from serving as jurors in the case. But since people opposed to the death penalty are also more likely to acquit a criminal defendant than someone not opposed to the death penalty, a death qualified jury is more likely to convict on each and every one of the charges before it, even if everyone on the jury promptly agrees in deliberations that the prosecutor has not established the death penalty carrying charges beyond a reasonable doubt.
Thus, bringing a weak death penalty charge both enhances the odds that there will be a conviction of something at trial, and enhances the plea bargaining position of the prosecutor both due to that greater change of prevailing on the merits at trial, and because the "worst case scenario" still drives the plea bargaining process to a significant extent.
Furthermore, jury trials are inherently uncertain ordeals. My working estimate that I share with my clients is that even if the law and the facts seem to perfectly favor one outcome or another, that there is at least a 10% chance that the jury will get the wrong result. And with an additional charge carries the death penalty, or a long term in prison, as a possible sentence, a 10% risk of that happening is enough to strongly encourage a criminal defendant to plea guilty in a case where the defendant might otherwise "roll the dice" at trial if the more serious charge wasn't on the table.
There is also a more subtle issue, which isn't precisely "overcharging" but is related.
At trial, the prosecution is only allowed to introduce evidence which is "relevant" to the charges presented to a jury. So, for example, suppose that the primary charge at a trial is aggravated assault. In a pure aggravated assault case, the prosecution would probably not be allowed to introduce the fact that the defendant was suspected of being a drug dealer or participant in organized crime.
But if a charge of drug dealing the minimum quantity of a drug for a charge of that type that was found in the vicinity of the defendant were brought, even if showing the defendant actually owned those drugs is difficult or impossible to prove beyond a reasonable doubt, the drug dealing charge would open up the ability of the prosecution to present all sorts of evidence showing that the defendant was affiliated with a drug dealing cartel. And while this evidence wouldn't be legally relevant to the more serious aggravated assault charge brought, this character attack and legally irrelevant context might sway the jury.
Also, even if the jury would have convicted anyway, the presence of additional relevant issues in the case would make it easier for the prosecution to prevail on appeal in the face of a defense argument that the judge improperly allowed the jury to consider irrelevant and prejudicial evidence.
As something of an aside, fighting alleged overcharging by the prosecution is one of the core responsibilities of a criminal defense attorney. It is quite rare that someone going to trial on criminal charges is not guilty of some crime (and when this is the case, the criminal defense attorneys' job is the hardest). But it is far more common for there to be a case where a criminal defendant is undeniably guilty of some crime (e.g. larceny), but where some other more serious charge (e.g. robbery or burglary) is marginal at best. Making sure that a criminal defendant is only punished for the crimes that he or she clearly did commit, and not for more serious overcharged crimes, is frequently a major issue for a criminal defense attorney defending someone who is clearly guilty of some crime.