Poe's story is often considered in terms of symbolism or allegory; the setting itself, an abbey full of nobles hiding from a plague, seems a bit fantastic and may stretch the reader's belief in the literal truth of the story, leading to more careful interpretation.
The masquerade makes more sense, in terms of symbolism and allegory, when taken in context; the nobles value the comfort of their own lives above all things, and by fleeing the plague they are, in a sense, attempting to escape mortality itself. They wish to blind themselves to uncomfortable truths and live in blissful ignorance. The masquerade serves merely as a distraction; it allows everyone to pretend that their circumstances are more pleasant. Why cower and contemplate death when you can have a party instead?
The masquerade serves both to cue the reader to the corruption and degenerate morals of the nobility, and to highlight their powerlessness against the Red Death; it cares not where or how its victims choose to mislead themselves.