The Importance of Being Earnest falls under the category of Comedy of Manners. This genre aims to mirror the behaviors and dynamics of the "polite" society of the upper and middle classes. However, the style employed to move the action is through satire, which is the mocking and the exaggeration of such behaviors and dynamics.
It is precisely the use of satire that would have made the play funny to the 19th century audiences that congregated in Saint James's place to first witness The Importance of Being Earnest in its debut on Valentine's Day, 1895.
Now, let's move on to witticism versus entertainment. Wilde's success at comedies of manners lies precisely on the fact that he is a master of language. Even before he became a playwright, Wilde was, both, famous and notorious for his use of epigrams, irony, sarcasm, and paradoxes in his everyday conversations.
His conversation skills secured him invitations to the most important houses of fashionable London, and it was through his talk, and not through his writings, that he actually became first known. Imagine the excellent match between the satire expected of a comedy of manners, combined with the naturally-sarcastic and instantly hilarious style of Wilde's typical language.
This is why this play is still so successful; it transcends time and style because the dialogue, the "smart-talk", and the axioms established so nonchalantly by Algernon are intrinsic pieces of the author's own life and personality. In all, Earnest is sort of an extension of a day in the life of Wilde, and knowing this aspect of the author made the play all the more funny and sincere to the audience of his time.