Sir Walter Scott, in a non-fiction work, Letters On Demonology and Witchcraft, describes an early idea of the elfin people. This involved the Norse duergar or dwarf. These “dwarves” were spirits of a coarser sort and of more malignant temper than were the Celtic fairies. Scott speculates that the duergar of the Norselands may have originally been diminutive natives of the Lappish, Lettish, and Finnish nations who, retreating from the conquering weapons of the Asæ, sought the most retired regions of the North, and there endeavored to hide themselves from their Eastern invaders. “They were a little, diminutive race,” writes Scott, “but possessed of some skill probably in mining or smelting materials, with which the country abounds.”
It has been theorized that these duergar, who sought caverns and hiding places from the persecution of the Asæ, were in some respects compensated for inferiority in strength and stature by the art and power with which the “superstition” of the enemy invested them. These oppressed yet dreaded fugitives gradually obtained the character of the German spirits called kobold, from which the English goblin and Scottish bogie are evidently derived. The kobolds were a species of gnomes, who haunted the dark and solitary places, and were often seen in the mines, where they seemed to imitate the labors of the miners. 
Benjamin Thorpe, in a work first published in 1852, Northern Mythology, relates how a miner working in a shaft in Germany was approached by a little old man clad in white. “Come with me,” said the little old man. The miner followed him into what seemed to be a spacious hall. There, persons like the little old man were having a feast. The miner was invited to sit down and join them, which he did. A gift of a gold pin was given to the miner. 
Elsewhere, Thorpe tells of the Hübichenstein (image), which is an unusual rock formation in the Harz mountains, 50 meters in height, located on highway B242 about one kilometer northwest of Bad Grund, Lower Saxony, Germany. Deep beneath the Hübichenstein the dwarves had their dwelling. Their king was the Gübich, who was shaggy like a bear and whose face looked very ancient. In the olden times, the Gübich was wont to appear in the neighborhood of the Hübichenstein, near Grund, a small town remarkable for its vast subterranean works for the draining of the mines. The Gübich was short in height. He used to appear in the upper world every 100 years, but now seems not to do so. 
Relevant to a connection between the Pied Piper of Hamelin and subterranean people is Thorpe’s telling of the pied piper incident. Thorpe has it that the Pied Piper of Hamelin had been “most singularly clad” when first seen in the town. The “rat catcher” embellishment is included by Thorpe, a part really added on later, after the original incident, in my opinion. The pied piper incident had happened in 1284. Later, around 1348 – 1350, the “Black Death”, a plague carried by Oriental rat fleas living on black rats, arrived in Germany.  The pied piper story had been handed down through oral tradition. Roughly 65 years after the original incident, circa 1348, rats and the Black Death would have begun to be uppermost in people’s minds.
After “cheated rat exterminator” wearing “singular” clothes is swept aside, we have Thorpe continuing that the pied piper returned to town on June 26th, 1284 but this time “clad as a huntsman, with a fire-red hat, and had a most terrific countenance. He struck up a tune, at which all the children were so fascinated, that they must needs follow him at every step. Slowly he marched up the narrow street leading to the east gate, with the children in great number after him; then, passing through the gate, proceeded to a mountain called the Koppelberg, in which they all disappeared.” A nursery maid witnessed that the mountain had opened and then, once the man and 130 children had entered the mountain, it had closed. “Fathers and mothers now rushed out at the east gate, but when they came to the mountain, nothing was there observable but a small hollow, where the sorcerer had entered.” A footnote from Thorpe adds, “Many are the relations of this event.” 
Sir Walter Scott, in Letters On Demonology and Witchcraft, includes mention that the “fairies” (which presumably would include the kobold) were in the constant habit of carrying off children and breeding them as beings of their own race. Recall too how, in Strange Case of Pied Piper, the Ersjdamoo’s Blog entry of June 7, 2015, “A person once saw a female dwarf going across a field with a stolen child.”
Add it all together and you have a “pied piper” carrying off children who vanish into a mountain, a dwelling place of the subterranean people, the kobold.
——- Sources ——-
 Scott, Walter. Letters On Demonology and Witchcraft.
 Northern Mythology: Popular Traditions and Superstitions of Scandinavia, North Germany, and The Netherlands (Vol. III), by Benjamin Thorpe. London: Edward Lumley, 1852
 “Black Death”, Wikipedia, June 8, 2015.