Maybe he actually did.
Hypothesis 1. The Dwarven Arts
According to The Unmanly Man: Concepts of Sexual Defamation in Early Northern Society, Preben Meulengracht Sørensen is convinced, for some reason, that Loki's milkmaid service "must certainly be taken to mean that Loki served as mistress to giants or trolls," which he qualifies by adding that the "sexuality [of giants and trolls] was considered gross and unbridled".
There is, however, a different group associated with dwelling underground just as much as if not more so than giants or trolls, and that is the dwarves, particularly those of Svartálfaheim ("Black-Elf World/Home"). This seems to be the realm to which, in Skáldskaparmál 35, Loki ventures with a mission to get a collective of artisans called "Ívaldi's Sons" to make new hair for Þórr's [Thor's] wife Sif. With no further explanation, this portion of the Eddas tells us that the artisans made the hair and, seemingly off the cuff, threw in two extra items: Skíðblaðnir, a magic ship which could be folded up and placed in one's pocket like a handkerchief, and which was gifted to the god Freyr; and the magic spear Gungnir, which eventually belonged to Óðinn [Odin].
In circumstances otherwise unexplained, Loki then made a life-and-death wager with a different (rival?) family of dwarf artisans, inducing them to make a few other magic gifts for his fellow deities. This second group of dwarves ended up making, among a few other items, Þórr's famous magic hammer Mjöllnir. In this instance the artisans have clear motivation for this work but it's always puzzled me that there is no explanation ever offered (as far as I'm aware) for why Ívaldi's Sons help Loki at all and go a couple of extra miles in the process, with no apparent word of gratitude towards them. Were they on the Æsir's retainer or something? For them to be so gracious about receiving nothing at all for their labour is completely out of character for dwarves (or for that matter just about every other major ethnic group) in this mythology.
On a later occasion the giant king Þrym [Thrym] somehow managed to steal Mjöllnir from Þórr and then demanded to be given the hand of Freyr's twin, the beautiful goddess Freyja, in marriage. To trick him, Þórr and Loki were compelled to dress in drag in order to impersonate Freyja and her handmaiden respectively, by which ruse they were able to retrieve the magic hammer and slaughter Þrym and his entire family.
A standard part of Þórr's disguise in this instance had to be Freyja's famously bedazzling torc [a type of choker] called Brísingamen. According to Sörla þáttr eða Heðins saga ok Högna ("The Tale of Sörli, or of Heðin and Högni"), Freyja once bought a golden necklace from a group of four dwarves who refused monetary payment. Instead they demanded that she lie with each of them for one night, which terms were accepted. Sörla þáttr does not say that this necklace is actually the same as Brísingamen nor does it say anything about the dwarves being a group of brothers called the Brísingar, but both these features are popular modern interpretations, as attested by Jimmy Joe's website TimelessMyths and Ingrid Halvorsen's website Sunnyway, perhaps inspired by Roger Lancelyn Green's book Myths of the Norsemen, first published in 1960.
Skáldskaparmál offers no further detail regarding Ívaldi's Sons apart from saying that they are dwarves while at the same time suggesting that they are also Svartálfar, "Black Elves." Again, perhaps taking a cue from Green, Joe numbers these "sons" as four. The reason that Green might do so is to identify the four "Brísingar" with Ívaldi's Sons, whom he (on pp. 78, 84 & 87 of the 1970 edition of his aforementioned book) calls "Black Dwarfs" in a bid to explain why these dwarves have their operations base in Elf-World.
To add my own speculations to those of Sørensen, Green, Joe and Halvorsen, my suggestion here would be that the mission into Giantland undertaken by Þórr and Loki may not have been the first time that Loki disguised himself as a woman associated with Freyja in order to acquire an item for the gods. Earlier in the same story it is Loki who discovers that Þrym has stolen Mjöllnir. He does this by reconnoitering in the form of a falcon. He is able to take this form because of a magic cloak of feathers owned by Freyja, which garment Loki borrows for this purpose.
It stands to reason that there's a missing story here regarding how Ívaldi's Sons came to owe Loki a favour. Perchance this time he didn't borrow clothing from Freyja or pretend to be her servant but actually borrowed her own form and performed a similar service towards the artisans in Svartálfaheim that Freyja would perhaps earlier have done in relation to the four dwarves who made her golden neck-piece, if Sörla þáttr is to be believed.
On other hand, these dwarves might be Loki's sons with Ívaldi as the father. Throughout the Eddas, elves and Æsir are cited in close association with each other [see under "Norsemen: The Svartálfar" in link]. The connection between the elves and these dwarves could thus be explained on account of their mother being an Ás [masculine singular of Æsir], the same Ás who gave birth, in the form of a mare, to Óðinn's magic horse Sleipnir. It would flow well in hand with Loki's irony and wackiness that he is a giant who becomes the parent of a collective of dwarves who create weaponry for the giants' traditional enemy the gods.
Hypothesis 2. The Unweeping Giantess
Speaking of Loki's offspring, he has a famous daughter, a giant goddess named Hel, or Hela, to whom Óðinn, in the Prose Edda, inexplicably gives apparently absolute authority over anyone who does not die in battle. These dead are sent to the land of perpetual cold, ice, snow and darkness at the northern end of the universe, over which realm Hel has control.
Óðinn soon comes to regret the decision because his beautiful son Balder, the universe's most favourite person, is killed some time afterwards through Loki's treachery, and he naturally goes to Hel. The Æsir must then petition Hel to release Balder (apparently to resurrect) if they wish to see him before they all die at the end of the world.
Hel is willing to break the rules and allow this on condition that every single person and object in the universe, dead or alive, weeps for the slain young Ás. If even one thing fails to do so, Balder will only be restored after the Ragnarök, as prophecy says. With that, according to the Gylfaginning, "the Æsir sent over all the world messengers to beg for Balder to be wept out of Hel; and all people did this, and living things, and the earth, and stones, and trees, and all metals".
Presumably even all the giants of Giantland participated as did Hel herself. However, in a certain cave somewhere there sat one giantess, poignantly named Þökk [Thok, "Thanks"], and she said that she had no love for Balder, calling him "the churl's son" and scoffing that Hel can keep him. This giantess, says the Gylfaginning, is suspected to have been Loki in disguise, which would make sense since Loki is the only person who hated Balder.
Immediately following this account is the story of Loki hiding in a mountain waterfall in the form of a salmon before being captured and subjected to some innovative and permanent torture methods by his fellow deities. After that is a description of the Ragnarök. The flytings in Lokasenna take place sometime after the messengers' encounter with Þökk and immediately before Loki's escape to the waterfall shortly prior to his final binding. If Þökk really is a cypher for Loki, perhaps [s]he was under such an incredible amount of pressure, as the only being in the entire universe refusing to facilitate the restoration of the world's most [well-]wanted man, that [s]he may indeed have needed to go literally underground.
And, as Loki's previous (mis)adventures have shown, there are certain things he is quite able (if not also quite willing) to do in a bind. Perhaps at the opening of Lokasenna eight years have elapsed since the first appearance of Þökk, who has been in hiding in a subterraneous cave in the company of giants or some other creatures, milking their cattle. And doing other things that Loki might do in order to keep up a disguise. This would require that Óðinn and Njörð already know somehow about Þökk-Loki's escapade. With Óðinn's two surveillance ravens, however, this would not be an especially difficult task.