A careful comparison of the accounts of Mary and Martha in St. Luke and St. John will reveal the great likelihood that the two accounts are one and the same; in addition, the textual evidence is rather overwhelming that Mary of Bethany, sister of Martha, is none other than Mary Magdalene.
What this means for the account in St. John 12 (and St. Luke 10) is that the dinner, which is taking place after Jesus has raised Lazarus, is a celebration of a restored family. The Magdalene has come home, and is no longer a "sinner" (i.e., public sinner, harlot); she has been shriven, has received absolution. She has been restored to the family. And Lazarus has been brought back from the dead, also restored to the family. This family is renewed by the mercies of Christ. It is most fitting that there be a supper, in celebration.
Meanwhile, Martha is troubled with much serving (St. Luke's account), and complains about her sister. But Jesus gently bids her to become like her sister who "has chosen that good part." Her sister is not only "hearing his word" (a la St. Luke), but anointing his feet (a la St. John). She is fully engrossed in Him who has had such abundant mercy on her. She is the preeminent example for all faith (well is she named Mary, which, I think, is no accident: she is like the Mother of God in this respect).
And this faith is vindicated by Jesus Himself: he says to Martha (a la St. Luke) that Mary has chosen the better part, "which shall not be taken from her," and he says to Judas (a la St. John), "Let her alone." Jesus is her defense and shield. So will he defend, shield, and vindicate all who, like Mary, trust in Him; and he will restore them eternally to the family of the faithful.