Everyone knows stories with morals. Disney's fairy tale adaptations are some of the best examples of this genre. (And if a fairy tale doesn't have a moral, someone will shoehorn one in somewhere.) Some stories weave the moral in subtly. Others are as subtle as a punch in the face. But there's nothing inherently wrong with a story having a moral.
The problem begins when people see morals where there aren't any.
Two examples from my own experience:
Last year I wrote a short story about a fairy who steals clocks. I'd no purpose in writing it except to entertain. But when I showed it to a friend, the first thing she said was, "What's the moral?"
For this year's NaNoWriMo, I'm planning a fantasy/mystery story which features a ghost, a werewolf, and a monster. I was discussing the plot with a friend when someone else -- who's an English teacher, which might explain it -- asked, "What lesson do you want this story to teach?"
"I don't want to teach any lesson," I told him. "It's just a mystery with monsters."
He didn't believe me. He said, "Every story must teach something!"
I did some reading, and discovered this is an attitude that's become increasingly widespread. Many people seem to think that unless your story teaches its readers something, there's no point in writing it.
I politely but firmly disagree with them.
A book can be good without teaching a moral. What moral does A Tale of Two Cities teach? "Never go to France or you'll have to die in another man's place"? What about Pride and Prejudice? "Marry someone who once insulted you, but only after they save your family from disgrace"? Or The Lord of the Rings? "Never pick up a ring you found in a cave or you'll start a war over the fate of the world"?
Obviously, these books don't have a central moral. And all of them are rightly considered classics. So the idea that a book must teach something is clearly wrong.
I suspect the people with this idea are confusing "moral" with "theme". Yes, the majority of stories should have a theme. Though there are plenty of stories out there without a theme which became popular anyway. Twilight, anyone? And there are genres where themes are unnecessary -- mystery novels, for example, usually don't have a theme beyond inviting the reader to solve the mystery along with the detective.
To reuse the example of the three books mentioned earlier, what's the theme of A Tale of Two Cities? "Recalled to life"/"I am the resurrection and the life" and the idea of coming back from (metaphorical) death are repeated multiple times through the book. What about Pride and Prejudice? Obviously, it's "first impressions can be misleading". At first Elizabeth thinks Darcy is a jerk and Wickham is a decent guy. By the end her opinion is the exact opposite. And The Lord of the Rings? Whole books have been written on its themes.
Returning to the subject of morals, should a story have a moral?
In my opinion, this is entirely for the author to decide. If you want to write a story with the moral "beauty is only skin deep" or "don't judge a book by its cover", that's up to you. But you'd better be careful not to hit the reader over the head with the moral. People who go to church want to be preached at. People who read books usually don't.
On the other hand, if you don't want your story to have a moral, that's also up to you. And without one, you're free to write your story however you want without worrying if it ever contradicts the moral. Far too many books out there ignore the lessons they claim to teach.
But whether the author intends to their story to have a moral or not, please don't assume every story must have one.