Four gospels, four anointings
Three are in Bethany, the fourth might be anywhere, including Bethany, though Luke surrounds the scene with places in Galilee. Two definitely take place in the home of Simon the Leper, whoever that is. John's anointing could also be in Simon's house, but we would have no way of knowing.
A woman enters. In the anointing scenes, a woman always enters. In Luke, she is a sinner, though the word need not imply that she is anything more than a non-observant Jew. In Mark and Matthew, her act (but not her name) will be remembered for ever. Mark goes so far as to build a memorial to old What's-Her-Name. Only John knows her name, but it won't do to import Mary into the synoptic scenes. When a storyteller chooses not to reveal a name, we have no business pretending that we know a secret that we have not been told.
The varied details of these related scenes tie them together. All four gospels know of a woman who anoints Jesus. Sometimes she anoints his head (Mark and Matthew), sometimes his feet (Luke and John). Sometimes the ointment is pure nard (Mark and John); Matthew, Mark, and John specify that it is costly (though the exact word they use varies); in the Synoptics it is in an alabaster container. In Matthew, Mark, and John, Judas Iscariot makes an appearance, but only John brings him into the anointing scene itself. All four know that someone was criticized in the scene, though only Luke imagines that it was Jesus. Usually the woman is attacked.
I do not think it serves any useful purpose to try to decide which version of the story came first. The Synoptics share details back and forth with John, defeating any easy analysis. All four canonical storytellers are fascinated by the scene. Each uses it to embody key structural themes in the story being told. Apparently, this little scene can be used by anyone to make any point that needs to be made, so the crucial interpretive task is to analyze it as part of the weave of the gospel in which it now appears: in Matthew, the woman continues a pattern begun in the genealogy, where women take decisive action to move the story forward; in Mark, it is this woman who establishes the narrative warrant for calling Jesus the messiah, the anointed one; in Luke the issue is hospitality and wholeness, and the storyteller lets the woman's act motivate Jesus to heal a rift in the people of Israel.
John's weave is equally complex, and very different. We are introduced to Lazarus and his sisters in chapter 11. We discover that Lazarus is a sick man, and that he is from Bethany, from the village of Mary and Martha, his sisters. Before we learn anything more, the storyteller informs us that Mary was the one who anointed him (in the past tense, though it has not yet happened). When we meet them again in chapter 12, Jesus comes into Bethany (he had retreated into the wilderness); he is on his way to Jerusalem for Passover, along with the whole flowing stream of faithful Jews going to celebrate freedom in the face of foreign domination. Bethany is identified (unnecessarily, since it's only been one chapter) as the place where Lazarus was, and Lazarus is identified as the one whom Jesus raised from death. Past is tied to future, the present moment is suspended in memories and actions that twist around each other, and the verb tenses can't keep up. Time is always tangled in John's story, but that probably should be expected, given that the story itself starts before time itself.
“They” gave a banquet
We don't know who “they” might be, but since Lazarus, the no-longer-quite-so-dead one, is listed among those reclining to eat and not as the host of the event, the event clearly extends beyond a small family gathering. The narrative context probably gives good hints as to why the whole town gives a banquet: the story is surrounded by reminiscences of the raising of Lazarus and of the joy this caused in the area. Jesus probably never had to pay for drinks or a meal in Bethany ever again. Apparently Jesus was not the only person in Bethany who loved Lazarus.
She anoints Jesus' feet. The entire action takes only one verse. This single verse is solidly concrete in the midst of John's often ethereal story. Mary carries a container of nard, pure and costly. She anoints his feet. She wipes his feet with her hair. The house was filled with the smell of the ointment. These very specific, very concrete moments of sensation give this scene a remarkable solidity. The smell fills the house. The last time we met Lazarus, there was also a smell. Martha pointed it out that time. It was the smell of death. This time it seems to be the smell of rejoicing at the restoration of life, though Jesus turns it back to death in his commentary. Life and death dance together tightly in John's story, and the smell links them.
The scene also involves feet and hair, customary elements that show up in various Synoptic versions. The elements are customary, and common, since most of us have feet and many of us have hair. But these feet and this hair bring an intensity to the scene that you can only discover when you perform the scene. Lazarus is reclining to eat. Presumably, so is Jesus. Mary therefore has to kneel to apply the ointment. That change of posture focuses the scene. By most accounts, we should image that women were veiled in ancient Jewish culture, and that their hair was coiled tightly, unseen except by her closest family members. Before she can wipe his feet, she has to remove her veil (whatever its exact nature) and unbind her hair. That action takes time, and during that time, the silent scene focuses entirely on her. The sight of her hair (which St. Paul describes as the “glory of a woman”) would have surprised, even frozen, the crowd. Then she has to bend deep down to wipe the feet with her hair.
Find a pair of actors (or people simply willing to embody the scene), and do this.
The intensity of the scene will surprise you.
When the anointing is connected with the raising of the brother, Lazarus, Mary's intense joy will overwhelm you. The act is powerful, intimate, astonishing, breath-taking. The entire community is gathered to celebrate the joy of (for once) receiving back from death an essential person who had died. Their joy is focused by the specific act of a sister who had lost a brother. The power of the scene makes sense. The intimacy makes sense. But you will be surprised by how powerful and how intimate if you actually play the scene.
Judas objects, but his objection now emerges as an even deeper offense. The mention of his thievery seems even beside the point, since he is really objecting, not to waste, but to joy and love. And because Jesus immediately links the anointing to his own entombment, Judas is also made to object to the resurrection. This use of the character, Judas, causes problems, especially given the history of interpretation, which connects (all too gladly) Judas with the Jewish people. At least one layer of John's story (the latest and angriest layer, I argue) makes the same sort of connection. Interpreters ought step wisely along such trails, walking on them critically or not at all.
The whole story
But this little scene with its tight physical focus finally holds the whole story together. The characters, the aroma, and the purposefully distorted verbs tenses link the anointing to the raising of Lazarus. This insistent distortion of time links it to the beginning of John's story beyond the structure of time. The aroma also links this celebration of life to a memory of death, and Jesus connects this link, himself, when he reminds the audience of his entombment, a matter they could not forget. Life and death are linked back to life that rises from death.
And all of this is held in Mary's hand with the container of ointment. All of this is held in her powerful actions: kneeling, unveiling, unbinding, bending, and wiping. And the entire story is bound up in the joy that Mary embodies. This ties Mary to the disciples at the end. This ties Mary also to the God's joy at the beginning of creating and loving the cosmos. Mary embodies John's whole story.