First of all, I'd like to point out that perhaps Han is the Master of All Galactic Farmingthe Master of All Galactic Farming, but if so, he's not the only one. Princess/General Leia Organa did some farming as well, apparently, between Princessing, Senatoring and Rebelling:
"Why, you stuck-up, half-witted, scruffy-looking nerf-herder!"
Second of all, from Star Wars: Prelude to RebellionStar Wars: Prelude to Rebellion #4/#5 (part of "Vow of Justice ArkVow of Justice Ark), we know they are native to Ki-Adi-Mundi's Cerea (they aren't named in the comic, but the image in your question and WookiepediaWookieepedia page comes from the comic, we see a warlord riding one in #4, and a farmer plowing using a couple in #5. Don't think anyone milks any, in any canon I'm aware of before Episode VII, but clearly they are patterened on Earth bovines, so that makes a certain amount of sense, even if only in a "ducks" context.
They are actually named in "Star Wars: Force and Destiny"Star Wars: Force and Destiny Core Rulebook, on page 368 which describes Cerea in detail and mentions that it's a largely agricultural planet and describes farmers purchasing "Plowing Moofs" - as witnessed in the picture.
One major feature of the planet is its refusal to use technology (think American Pensilvania Dutch, aka AmishAmerican Pennsylvania Dutch, aka Amish):
Cerea is a small, backwater agriworld and home to the cone-headed Cereans. Its endless hills and forests provide ample farmland for all Cereans, who prefer to maintain a simple, rustic existence. Cereans usually build their houses from local materials, and they run their farms without any industrialization. The fact that Cereans have two hearts is well known, and most say the first is for the family, but the second is for Cerea itself. For fear of pollution and industrialization of their verdant homeworld, Cereans have outlawed most technology. However, the policy does not apply to the local Imperial garrison and those in Outsider Citadels, as long as they keep their tech on the premises.
##This local specifics clearly explains why someone who makes a bone-headed technical decision - like installing a compressor on the ignition line - would be called a Moof-Milker.
Digging further, Cerea was not a major event place around Han's time (it was nearly destroyed in Clone Wars), and I couldn't find any evidence of Han being there (including no plausible mentions on Cerea's Wookiepedia "appearances" listCerea's Wookieepedia "appearances" list which is dominated by Old Republic or Clone War timelines).
However, on Cerean Wookiepedia page for LegendsCerean Wookieepedia page for Legends has this interesting hit in Appearances section: Star Wars Adventures: Han Solo and the Hollow Moon of KhoryaStar Wars Adventures: Han Solo and the Hollow Moon of Khorya
However, in that comic, the only Cerean I'm aware of is a butler/majordomo/gofer/bookie type for gangster SollimaSollima; and I really don't see Han discussing farming with him at all - Solima is the only one who talks to him, when ordering Chewie to be put into Arena Games.
As such, absent evidence of Han knowing any other Cereans that I can discover, I can only conclude that he has about the same knowledge of Moof Milking as both Leia and he have of Nerf Herding - that is, being conversant with Galactic Slang.
And Han chose that specific expression with great precision, given Cerean anti-technology centiment and backwardness explained above.
Please note that this is common in Earth cultures. We have people calling each other "Jackals" or "Cowboys" in pejorative way, despite never having been around a live Jackal, or been on a ranch (or frequently even knowing what it is that an actual cowboy does).