Richard Musgrave (1957, 1959) invented the term. My interpretation of what he says (below) is that merit goods are simply goods that the "community" deems desirable, while demerit goods are those the "community" deems undesirable.
He (1987) writes that the concept (of merit goods) is "best applied where individual choice is restrained by community values" ... "Community values ... give rise to merit or demerit goods" ...
Such goods are where "community values" act "as a restraint on individual choice". The "evaluation of a good (its merit or demerit) derives not simply from the norm of consumer sovereignty but involves an alternative norm."
- Examples of merit goods are "Concern for maintenance of historical sites, respect for national holidays, regard for environment or for learning and the arts."
- Examples of demerit goods are drug use and prostitution because they are "offences to human dignity (quite apart from potentially costly externalities)."
P.S. There is of course the difficult question of who or what exactly the "community" is. If I may add my humble opinion, all of this sounds very illiberal and even mildly fascist. Which is perhaps why this concept hasn't been much taken up by mainstream economics.
P.P.S. The above is merely Musgrave's interpretation. As Musgrave himself says:
The concept of merit goods ... has been widely discussed and given divergent interpretations ... it is thus difficult to provide a unique definition.