1 Then, six days before the Passover, Jesus came to Bethany, where Lazarus was who had been dead, whom He had raised from the dead.
2 There they made Him a supper; and Martha served, but Lazarus was one of those who sat at the table with Him.
3 Then Mary took a pound of very costly oil of spikenard, anointed the feet of Jesus, and wiped His feet with her hair. And the house was filled with the fragrance of the oil.
4 But one of His disciples, Judas Iscariot, Simon’s son, who would betray Him, said,
5 “Why was this fragrant oil not sold for three hundred denarii and given to the poor?”
6 This he said, not that he cared for the poor, but because he was a thief, and had the money box; and he used to take what was put in it.
7 But Jesus said, “Let her alone; she has kept this for the day of My burial.
8 For the poor you have with you always, but Me you do not have always.”
9 Now a great many of the Jews knew that He was there; and they came, not for Jesus’ sake only, but that they might also see Lazarus, whom He had raised from the dead.
10 But the chief priests plotted to put Lazarus to death also,
11 because on account of him many of the Jews went away and believed in Jesus.
This event took place on Jesus's last trip to Jerusalem — Luke 18:31-33
He arrived in Bethany on Friday (v. 1), a week before His death.
The meal (v. 2) was at the house of Simon the (former) Leper — Matthew 26:6.
"But Lazarus was one of them that sat at the table with Him" (12:2). This illustrated the true Christian position. Lazarus had been dead, but now alive from the dead, he is seated in the company of the Savior. So it is (positionally) with the believer: "when we are dead in sins, hath quickened us together with Christ … And hath raised us up together, and made us sit together in the heavenlies in Christ Jesus (Ephesians 2:5-6). We have been "made meet to be partakers of the inheritance of the saints in light" (Colossians 1:12). — Exposition of the Gospel of John, by Arthur W. Pink, page 234.
The other disciples were upset by Mary's extravagance, but Judas was their spokesman, or he incited them by his response — Matthew 26:8; Mark 14:4. He was upset that Mary gave up her 300 denarii investment, then he himself sold out Christ for only 30 denarii.
Judas was the treasurer (v. 6), and he stole from the pot.
Mary knew something was up (v. 7), even if she didn't know the details of Jesus's death. Her act was annointing Jesus in death.
kept (v. 7) = diligently preserved.