The people of Hemlin are distraught and searching for a solution to rid themselves of horrible rats that have consumed their town. The stranger comes to town at just the right moment claiming he is able to fix their crisis. The town elders accept, and in their enthusiasm offer the stranger fifty times more than he originally asked for. Whether or not their intentions were to give him what they offered or not is debatable, but most likely they believed he could not do it. Therefore proposing an absurd amount on the grounds that he would not succeed. However in the end they refused to even give him the minimum he asked for. Now that their problem was solved they had no use for the stranger and no real need to pay him, or so they thought.
The story is really a parable about the problem of greed. In their exuberance and greed the townspeople denied the piper his money, and they ended up losing something even more valuable than their money, the children. I had heard this story many times before but never remembered the part about the children leaving; it's not a very happy ever after ending like most tales. Most likely it is this way to prove a point that greed only leads to downfall and loss. One thing that struck me as I read the story was that the piper was almost portrayed as in the right for getting even with the townspeople. But I think taking the children away was a horrid thing to do, but it could have been exaggerated in this tale to get a message across.