This MusTrad Article provides a useful discussion, much of which is summarised by Malcolm above. The first printed version seems to have appeared in the 1820s and it was clearly very popular on broadsides in the 19th Century (including the period during which it was being collected).
Malcolm ... I counted 17 different versions in The Bodleian!