1474 His relative was Mary, it was Mary who anointed the Lord with ointment and wiped his feet with her hair. The Evangelist describes this Mary by her most famous action so we can distinguish her from the many other women with the same name. Still, there is some disagreement among the saints about this Mary. Some, like Jerome and Origen, say that this Mary, the sister of Lazarus, is not the same as the sinner mentioned in Luke (7:37): "A woman of the city, who was a sinner...brought an alabaster flask of ointment, and standing behind him at his feet, weeping, she began to wet his feet with he...r tears, and wiped them with the hair of her head." So, as Chrysostom says, she was not the prostitute mentioned in Luke. The Mary mentioned by John was an honorable woman, eager to receive Christ, while the name of the woman who was the sinner was kept secret. Furthermore, the Mary mentioned here by John could have done for Christ at the time of his passion because of her special devotion and love something similar to what was done for him by the sinner out of remorse and love. John, in order to praise her, is mentioning here, in anticipation, the action she would perform later (Jn 12:1-8).
Others, such as Augustine and Gregory, say that this Mary, mentioned by John, is the same as the sinner mentioned by Luke. Augustine bases his reason on this text. For the Evangelist is speaking here of the time before Mary anointed our Lord [for the second time] at the time of the passion; as John says further on: "Mary took a pound of costly ointment of pure nard and anointed the feet of Jesus." So he says that what the Evangelist has mentioned here is the same event mentioned by Luke (7:37). [Ambrose maintains both sides.] So, according to the opinion of Augustine, it is clear that the sinner mentioned by Luke is this Mary whose brother Lazarus was ill. [Augustine says] a consuming fever was wasting his wretched body with its furnace-like flames.
Source: Commentary on John