The Root of the Behavior
Well, one thing is for sure, it seems like a strong case of temporary insanity. Even if they are just straight home from the groomers and there is some mud sitting between them and the door and they make a B-line straight for the dirtiest place they can. They aren't insane. Not any more than a child who loves to dance in the rain or play in the mud. A lot of this comes from boredom, they just simply don't have anything better to do. Boredom strikes a canine just like it would a child. Although boredom is often the culprit, or at the least a portion of the equation, it is not necessarily the primary cause. On a hot and humid summer day, some cool wet mud can just hit the spot. The moisture and cooler temperatures can help your dog cool off. If they are overheating then this may be the primary cause of the behavior.
There is speculation that this behavior is, in fact, instinctual. The basis for this comes from predatory behaviors. Rolling around in mud or other substances can mask their scent, allowing them to sneak up on prey more efficiently. Dogs do not really hunt anymore, they have become domesticated through hundreds of years of human companionship. However, it has not always been that way. Wolves have been observed to show similar behaviors, rolling in mud or animal carcasses to mask their scent for their hunt. It is not just wolves, it is a pretty common staple in the canine family and several other species of predators have been observed to use the same techniques. In some cases, it is a learned behavior. Unfortunately, humans and dogs do not communicate with each other well. Often we make some mistakes, often early in the dog's life, that leave lasting repercussions. If, when your dog was a pup, he ran around and played in the mud and you thought it was adorable then you may have caused them to continue this behavior.
Encouraging the Behavior
Well, unfortunately, dogs like playing in the mud. That probably is not going to change. There are things you can do to reduce the mud that they track into your home. Keeping your dog's hair short is going to stop him from picking up as much of the dirt as possible and make them easier to clean off before they come into the home. The shorter hair will also help keep your dog cooler, which could reduce their incentive to play in the mud.
Make sure they have toys and games they enjoy around the home. To many dogs, that is exactly what mud is, a toy or a game. Keeping some toys or things to otherwise occupy their time may keep them out of the mud, or at least reduce the time they spend in it. Using disciplinary behavior in this case is not likely to give you much success. Your canine will not understand why you are upset and your intended correction will just make them scared. Some positive reinforcement may be beneficial in the right circumstances. When they run out to go into the mud, tell them no. If they do not jump around in the mud then rewarding them for that behavior could have marked results in the future.
Other Solutions and Considerations
Most dogs hate taking a bath. Some, however, feel very differently. If your dog loves to get washed by you then you need to resist the temptation to clean them each time they play in the mud. If they consider a wash to be a pleasant thing, then each time you wash them after playing in the mud you are teaching them to do just that. This incidental act becomes a form of cyclical reinforcement which encourages them to play in the mud whenever they want you to wash them down. Your reaction to them dancing in the mud the first few times can leave lasting impressions and incidentally teach them that this is acceptable behavior.