Luke 7:36-38 gives an account of how Simon, a Pharisee, invited Jesus to dinner and an unknown woman came and anointed Him. But in John 12:1-3 an account is given of Lazarus and his sisters inviting Jesus to their house and Mary anointing Him. Are these two different accounts or the same account told in different ways?
The moment recorded in Luke 7 and that recorded in Matthew 26/Mark 14/John 12 are different moments, and the context of each account makes the differences clear.
Specifically, we can list the notable differences:
In Luke's account, Jesus enters the home of a Pharisee named Simon. In Matt/Mark/John, the scene takes place in the home of a leper named Simon. Simon (or Shimon or Simeon) is a common Jewish name, but since a man with active leprosy would be unclean, he could never be accepted as a member of the Pharisee, therefore these two Simon's must be different men.
In Luke's account, the scene takes place somewhere near Nain, in the Galilee. In Matt/Mark/John, the scene takes place in Bethany near Jerusalem, which is a considerable distance away.
In Luke's account, the dinner is attended only by unbelievers (see Luke 7:49), while in Matt/Mark/John, the dinner is attended by Jesus' disciples Lazarus, Martha and Mary.
In Luke's account, the woman is called a sinner, likely meaning a prostitute, while the woman in Matt/Mark/John is Mary, the sister of Martha and Lazarus, who is never identified as a prostitute in the Gospels.
In Luke's account, the woman pours oil only on Jesus' feet, while in Matt/Mark/John the woman pours oil on both Jesus' head and feet.
In Luke's account, the woman is crying and using her tears to wash Jesus' feet, but in Matt/Mark/John the woman is never said to be crying and only anoints Jesus with the perfume.
These differences make it impossible to reconcile the two accounts into a single moment. Therefore, we conclude Luke alone recorded an early moment in Jesus' ministry when a prostitute came to Jesus in repentance, while the other three Gospels recorded a separate moment when Mary anointed Jesus in preparation for His death. These two occasions share several similarities, but the differences between the accounts make clear they are not the same.