The phrase was first used in print in a book published in 1839 by the American author C F Briggs. He wrote: "You had better buy 'em, Colonel," said Mr Lummucks, "they will sell like hot cakes." The suggestion of the need for haste tells you that they would sell quickly.