"Sing a Song o' Sixpence" is the opening tale in L. Frank Baum's 1897 collection Mother Goose in Prose. It illustrates Baum's method and approach in the book: the author takes the nonsense rhyme about blackbirds in a pie, and a pocketful of rye, and spins it into a consistent story.
Gilligren is an orphan who lives with his mean-spirited uncle and aunt. When he is twelve years old, the reigning king dies and is replaced by his son. Gilligren asks his aunt and uncle for sixpence, with which he will go out into the world to make his fortune. The adults see this as a good way to free themselves of the expense of raising him, and send him away with the one coin in his pocket.
Gilligren fares well at first, meeting kindness and generosity from common people on the road. He then accepts a ride on a farmer's cart; the farmer convinces the boy to trade his sixpence for a sack of rye, which he can get ground into flour, to bake into bread to sell. Gilligren accepts the proposition — but the farmer cheats him, giving him a sack of rye that is almost empty.
The orphan boy tries to use the sack as a pillow as he sleeps under a hedge that night; but the lumpiness irritates him, and in frustration he scatters the rye on the ground. The next morning, he finds that a flock of blackbirds has descended to eat the rye. He spreads his sack and catches twenty-four of the birds; then he resumes his journey to London. He finds the rear door of the king's palace; a servant learns of the contents of his sack, and drags Gilligren in to see the cook.
The capricious new king has ordered a blackbird pie; but the cook has been unable to find the prime ingredient, anywhere in the city. Gilligren agrees to turn over the birds, on two conditions: one is that the birds are not killed (for that would be cruel), and the other is that he get a job in the royal household. The desperate cook agrees, and Gilligren becomes the butler's page.
The pie with its live birds is served only at the end of the banquet, when the king has eaten his fill of more normal dishes. The pie is taken as a good joke by king and court; Gilligren is rewarded with an instant promotion to the king's page, the first step on a long and fruitful career in royal service. With the sixpence, the rye, and the blackbirds, the boy has made his fortune.