The] actual origin of this phrase is Biblical, when Jesus spat in the dirt and rubbed the wet dirt (mud) into they eye of a blind man, which healed the man's sight.
It also has a meaning from outback Australia. You are outside working hard and covered in dust, hasn't rained for months. When it rains the dirt turns to mud, this is a good thing so you crack open a beer and toast to the good times. "Here's mud in ya eye."