Poem origins
In the Victorian Era children had to learn many moralizing poems by heart. Carroll altered some of these (once very familiar) verses for the Alice books, of course to the amusement of the Liddell sisters. Unfortunately these poems are hardly remembered nowadays, so the fun of the parody has disappeared for the greater part.
The original poems are being compared to Carroll’s parodies here, and you can read more about their origins.

`Let’s hear it,’ said Humpty Dumpty. `I can explain all the poems that were ever invented — and a good many that haven’t been invented just yet.’
(Sources: Eleanor Graham’s introductions to the books, in an edition from Puffin Books (combined volume), the site from Cathy Dean and an e-text of the article ‘The Poems in Alice in Wonderland’, written by Florence Milner (published in ‘Bookman’, 1903))