If I remember correctly, there used to be an Elven city outside Moria, and they traded with the Dwarves. In fact, the wording on the door with the riddle was also written in Elvish, not the Dwarven language. This was obviously before Dwarven relations with the Elves went downhill. This is all based on what I remember from reading the trilogy's appendixes or maybe the Silmarilion, but I last read those books a while ago so I could be wrong. Still, trade of some sort. Keep in mind Moria was the main source of Mithril, a rare metal valued above even gold.