Unless your morals are wrecked, the totality of a villain should not be appealing to you. Moriarty's mental faculties may make him formidable, yes, but his description is that of a psychopath. The Joker is similar, except actually unhinged: the popularity of postmodern "deconstruction" (and Hollywood's need for novelties) led to his becoming the protagonist of his own movie--with at least some of his depiction explicitly being that of a sympathetic character meant to evoke empathy as well; none of this changes what he is and does. Hannibal Lecter is presented favorably in contrast with a number of other characters in the setting (including at least one that's supposed to be a "good guy"), being refined and also formidably intelligent--enough so to engineer his own escape from captivity. Despite these, he's what everyone knows him to be.
So, yes--villains have been portrayed favorably for quite a while, but that doesn't change the fact that they're villains: part of the appeal of all of these characters, especially the last two (far more than Moriarty, as Western society only started venerating vice to this degree recently; this doesn't actually apply to him--not in the era in which he was written, anyway), is that they satisfy a lust for novelty and exoticism very widespread in today's society; there's been no easier source of this, for decades now, than the embrace of evil as "misunderstood" together with the rejection of good as the product of traditional knowledge that--in true postmodernist fashion--ought to be questioned and subsequently cast aside as invalid for being so long-held.
Of course, this can be done--as you said. But what you think's happening when flagrantly vicious character traits are given positive depiction in characters who perfectly embody those traits and act by them left and right, while the concept of the "flawed" hero--rife with traits at odds with his status as a "hero"--becomes just as commonly employed? What's the result of this juxtaposition constantly being exhibited in entertainment media?
"The villain's not so bad after all~" "The hero's actually a bad guy..." The product of this being repeated ad infinitum is why villainous conduct is not meant to be glamorized.