Who shot John and who laid the rail

My mother has said this expression for years, as well as my grandmother too. What is the origin of the expression "who shot John and who laid the rail"?

I hope someone knows!

Replies