Steve Roud's folk song index list a broadside copy in the Madden collection, but I can't find it on the Bodleian Ballads website.Both the song here and Dibdin's "Andrew Carnegie" (with same story) I've seen as early as 1828, but both are probably older.
The "Johnny Sands" version is supposedly later.