From a Google search I see that one version is "the ins and outs of a cow's arse" (as the cow's digestive system is very complicated). Can I suggest that Meg was a Derbyshire farmer's cow and the expression caught on.
Re. colloquial expressions, I used to know a chap from Manchester who would say "It's black over Bob's mothers" whenever there were dark clouds in the distance. I often wondered who Bob was.