Since Mary carried sin her flesh, why didn't she pass it along to Jesus along with the curse upon humanity?
There are two reasons we know Jesus didn't inherit sin from Mary.
First, the word of God says the sin nature of humanity transfers from one generation to another through the reproductive process:
Rom. 5:12 Therefore, just as through one man sin entered into the world, and death through sin, and so death spread to all men, because all sinned —
Spiritually speaking, our sin nature is passed through the man (i.e., the "seed"). David confirms that sin passes to us in the moment of conception:
Psa. 51:5 Behold, I was brought forth in iniquity,
And in sin my mother conceived me.
But since Christ was formed in Mary’s womb by the Holy Spirit, and not by the seed of men, He did not possess a sin nature. We see evidence of this distinction in Genesis 3 where the Lord foretold the virgin birth of the Messiah:
Gen. 3:14 The LORD God said to the serpent,
“Because you have done this,
Cursed are you more than all cattle,
And more than every beast of the field;
On your belly you will go,
And dust you will eat
All the days of your life;
Gen. 3:15 And I will put enmity
Between you and the woman,
And between your seed and her seed;
He shall bruise you on the head,
And you shall bruise him on the heel.”
The mention of a woman's seed is a reference to the Holy Spirit's conception of Jesus within Mary. Importantly, a woman doesn't possess "seed" in the Bible's sense of that word, and yet here the Bible says the Messiah will be conceived by a woman's "seed," which is intentional to make the point that the Messiah would not be conceived in the normal way (I,.e., by a man's seed) but rather would be conceived in a woman without the help of a man.
Secondly, neither Joseph nor Mary contributed any "flesh" to Jesus' conception, according to Luke:
Luke 1:30 The angel said to her, “Do not be afraid, Mary; for you have found favor with God.
Luke 1:31 “And behold, you will conceive in your womb and bear a son, and you shall name Him Jesus.
Luke 1:32 “He will be great and will be called the Son of the Most High; and the Lord God will give Him the throne of His father David;
Luke 1:33 and He will reign over the house of Jacob forever, and His kingdom will have no end.”
Luke 1:34 Mary said to the angel, “How can this be, since I am a virgin?”
Luke 1:35 The angel answered and said to her, “The Holy Spirit will come upon you, and the power of the Most High will overshadow you; and for that reason the holy Child shall be called the Son of God.
Luke says the Holy Spirit conceived the child inside Mary so that Mary was a surrogate only. Conception naturally involves material from both a man and woman, but since Mary was a virgin the normal process was not used to conceive Jesus. He was formed like the original Adam: by God directly. Mary simply carried the child, but her body did not conceive the child.
Paul confirms this conclusion when calling Jesus our new Adam:
1Cor. 15:45 So also it is written, “The first MAN, Adam, BECAME A LIVING SOUL.” The last Adam became a life-giving spirit.
1Cor. 15:46 However, the spiritual is not first, but the natural; then the spiritual.
1Cor. 15:47 The first man is from the earth, earthy; the second man is from heaven.
Paul says that Christ was a new Adam, and the His body was not made of the earth like the first Adam (v.47), which tells us that Jesus' body was created (i.e., conceived) in the womb of Mary by the Holy Spirit without any connection to Mary's body. Therefore, Jesus received none of mankind's sinful nature, neither from Joseph nor from Mary, and therefore Jesus didn't inherit the sin of Adam.