According to Child, printed versions of this ballad probably date back to at least 1720. The first documented printing was in Tea Table Miscellany (1740). Variants and alternate titles include: Johnny Faa, Davy Faw, The Egyptian Laddie, The Gypsy Davy and Lord Garrick {and Blackjack Davey}.

The gypsies were expelled from Scotland in 1541 and then in 1609. In 1624 Johnny Faa (a title of prominent gypsies) and seven other men were sentenced to hang and Helen Faa and ten women were sentenced to be drowned, but the women's execution was stayed.

Circa 1788 this ballad became associated with John, the sixth earl of Cassilis and his first wife, Lady Jean Hamilton. Before her marriage Lady Jean was in love with "Johnny Faa, of Dunbar". Years later, after she had borne two children, Johnny Faa returned and persuaded her to elope. Johnny Faa and seven other gypsies (which correlates to the 1624 sentence) were hanged and Lady Jean was banished and confined for life in a tower built for her imprisonment. Eight heads, effigies of the gypsies, were said to be carved in the stone tower.

this is from

Versions of this song in recent musical history have been played by Steeleye Span, Fairport Convention, Bob Dylan, Woody Guthrie, and Doc Watson (probably others). It is also known as Blackjack Davey. This is an example of node what you kinda know, but could know better!