Allegory: Ante-Purgatory, Purgatorio 2
As the souls arrive at the shores of Purgatory they are singing Psalm 114 (113 in the Vulgate), which begins "In exitu Isräel de Aegypto" [When Israel went out of Egypt] (2.46-8). This very Psalm, not coincidentally, is used to illustrate a way of interpreting the Divine Comedy in a letter believed to have been written either by Dante himself or by another learned person of his age:
Now if we look at the letter alone, what is signified to us is the departure of the sons of Israel from Egypt during the time of Moses; if at the allegory, what is signified to us is our redemption through Christ; if at the moral sense, what is signified to us is the conversion of the soul from the sorrow and misery of sin to the state of grace; if at the anagogical, what is signified to us is the departure of the sanctified soul from bondage to the corruption of this world into the freedom of eternal glory. And although these mystical senses are called by various names, they may all be called allegorical, since they are all different from the literal or historical.
("The Letter to Can Grande," in Literary Criticism of Dante Alighieri, translated and edited by Robert S. Haller [Lincoln: University of Nebraska Press, 1973], 99)
This interpretive method, known as the "four-fold method" or the "allegory of theologians," was commonly applied to the Bible in the Middle Ages. The four senses could be remembered with the following medieval Latin ditty:
Littera gesta docet,
Quod credas allegoria.
Moralia quod agas,
Quo tendas anagogia.
The literal sense teaches what happened,
The allegorical what you believe.
The moral what you should do,
The anagogical where you are going.

The "Letter to Can Grande" also provides a more basic description of the allegory of Dante's poem:
The subject of the whole work, then, taken literally, is the state of souls after death, understood in a simple sense; for the movement of the whole work turns upon this and about this. If on the other hand the work is taken allegorically, the subject is man, in the exercise of his free will, earning or becoming liable to the rewards or punishments of justice.
What is most remarkable about Dante's idea of allegory, and what sharply distinguishes the Divine Comedy from many other allegorical works, is the poet's emphasis (sincere or rhetorical as it may be) on the literal or historical truth of his narrative as a foundation for any other level of meaning. Dante himself followed a simpler form of allegory in other works, such as the Convivio (dedicated to Lady Philosophy). The poem sung by Casella (2.112-14) is in fact a canzone ("Love that speaks within my mind") to which the narrator-commentator of the Convivio provides an allegorical reading.