
Dante's Terraces of Purgatory
First Terrace: Pride, by carrying a heavy weight on their backs. The wearer is unable to stand up straight (Cantos X through XII). This teaches the sinner that pride puts weight on the soul and it is better to throw it off. Furthermore, there are stones of historical and mythological examples of pride to learn from. With the weight on one's back, one cannot help but see this carved pavement and learn from it.
Second Terrace: Envy, by having one's eyes sewn shut, and wearing clothing that makes the soul indistinguishable from the ground (Cantos XIII through XV).
Third Terrace: Wrath, by walking around in acrid smoke (Cantos XV through XVII). Souls correct themselves by learning how wrath has blinded their vision, impeding their judgment.
Fourth Terrace: Sloth, by continually running (Cantos XVIII and XIX). Those who were slothful in life can only purge this sin by being zealous in their desire for penance.
Fifth Terrace: Avarice & Prodigality, by lying face-down on the ground, unable to move (Cantos XIX through XXI). Excessive concern for earthly goods - whether in the form of greed or extravagance - is punished and purified. The sinner learns to turn his desire from possessions, power, or position, to God.
Sixth Terrace: Gluttony, by abstaining from any food or drink (Cantos XXII through XXIV). Here, people's desire to eat a forbidden fruit causes their shade to starve. Once they master their desire to be a glutton, their appetite for sin leaves them and they are no longer starved by it.
Seventh Terrace: Lust, by burning in an immense wall of flames (Cantos XXV through XXVII). All of those who committed sexual sins, both heterosexual and homosexual, are purified by the fire. Excessive sexual desire misdirects one's love from God and this terrace is meant to correct that. In addition, perhaps because all sin has its roots in love, every soul who has completed his penance on the lower six cornices must pass through the wall of flame before ascending to the Earthly Paradise.
I think the parallels are obvious. I am not sure why Tolkien wanted this in his Master work, but there it is.