Harold Jenkins's edition of Hamlet for the Arden Shakespeare (1982) says in a footnote to Hamlet's "A poisons him i'th' garden for his estate" that this appears to echo a folklore motif and quotes The Revesby Play: "for your estate we do your body kill". But this doesn't seem to refer to poisoning via the ear.
Hamlet also adds that the play is based on a story in Italian. Jenkins's footnote is of not much help: "This was probably true (...), though Shakespeare's actual source has not been traced."
Jenkins expands on the source in a longer note on pages 507–508, in which he adds that The Murder of Gonzago seems to be based on a real murder, namely that of the Duke of Urbino in 1538;
Gonzago, however, was not the name of the Duke, but of his alleged murderer, Luigi Gonzaga, a kinsman of the Duke's wife, Leonora Gonzaga.
The rest of Jenkin's note is about potential misreadings of names by typesetters (or scribes?) and differences between the Folio and older editions of the play, and does us not bring close to the source of Shakespeare's idea of poisoning via the ear.
G. R. Hibbard's edition of Hamlet for the Oxford Shakespeare (1987), which is also very detailed, doesn't have footnotes for the passages quoted above.
According to Kathryn Harkup's Death by Shakespeare (2022), the idea of administering something through the ear may have come from Pliny:
[Pliny's Natural History] contains a recipe for curing earache using the juice of henbane, opium and rose-oil among other ingredients. The mixture was warmed up and introduced into the ear using a syringe. It would also explain Shakespeare's strange choice of the ear as the site for applying poison.
Harkup points out that the ear is a poor choice for administering poison for two reasons: first, the presence of earwax, and, second, the presence of relatively few blood vessels to absorb the poison.
However, inserting something into the ear, like a syringe or a tube, to deliver the substance could have perforated the eardrum and allowed poison or medicine easier access to the rest of the body.
(Scholars assume that Shakespeare had read Pliny's Natural History because of references to Anthropophagi, Arabian trees that drop gum and the description of the Pontic Sea in Othello. Philemon Holland's translation of Natural History was published in 1601, which would have been too late for Hamlet but before the completion of Othello. But Shakespeare may have read Pliny in Latin anyway.)
According to Caldecott's edition of Hamlet and As You Like It (1832, page 41; links added by me),
It has here however been observed by Dr. Sherwen, that, though neither physiology nor pathology know of any such effects produced by poison, poured into the ear, the medical professors of Shakespeare's day believed, that it might be so introduced into the system; and that the eminent surgeon, Ambrose Paré, our author's contemporary, was suspected of having, when he dressed the ear of Francis II., infused poison into it.
Shakespeare may have gotten the idea from contemporary history, i.e. the suspicions against Ambroise Paré, rather than Pliny or a literary source.