Notice here that Utahraptor is in one of his exasperated moods, just smiling and nodding at T-Rex. Anyway...
There is an element to ghost stories which comes from the fear of the unknown, and going where you shouldn't go. This is common, though, to many other folklore tales and urban legends, stories that might not necessarily involve ghosts.
The thing I find more interesting about ghost stories is that there is usually something inappropriate about the way that the person died. In the case of the myling, it was said to have been a child who died without baptism or proper burial. This usually meant that it was a child that would shame the parents (e.g., born out of wedlock), and they abandoned it to die in the wilderness. Without baptism or burial, the children's souls couldn't go to heaven, and luring people to their deaths was the myling's form of revenge.
The idea of the ghost is usually meant to give people more respect for people's lives, and how they are treated after they die. The fact that there is a "proper" way to deal with people who have died is something universal to all cultures, even if what counts as "proper" varies considerably. Burial and cremation are pretty common, cannibalism is a little more rare. I've even heard of a culture where the body is left out for a few days to let animals eat the flesh off of the bones, and then the bones are buried, or something. I think I read it in Mircea Eliade's book Shamanism: Archaic Techniques of Ecstasy. Fuck yo citation. It's not that relevant.
The process of preparing a body for disposal gives a community time to grieve, and get all of the work of mourning out of the way at once. People tell stories about the deceased, and it becomes more acceptable to cry in otherwise inappropriate settings. Some people will still be grieving after this period, but the first few days can give them the spiritual resources they need to come to terms with the death.
We all die some day, which makes it that much more appropriate to have a proper and almost scripted way to deal with death. Ghost stories are a warning about what could happen if we take a callous attitude towards people's life and death. Your actions could have consequences in the future for many people, some of whom have not even been born yet.