Botanically called Lysimachia, a Greek compound meaning the same thing. The author of Flora Domestica tells us that the Romans put these flowers under the yokes of oxen to keep them from quarrelling with each other; for (says he) the plant keeps off flies and gnats and thus relieves horses and oxen from a great source of irritation. Similarly in Collins' Faithful Shepherdess, we read-
Yellow Lysimachus, to give sweet rest, To the faint shepherd, killing, where it comes, All busy gnats, and every fly that hums.
(Pliny refers the name to one of Alexander's generals, said to have discovered its virtues.)
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894
More on Loose-strife from Infoplease: