Jesus must've been conceived in a supernatural way akin to IVF, not IUI (intra-uterine insemination), therefore he was NOT coded with Mary's DNA (which would be distantly related to Joseph's, since they both descended from king David).
I believe Jesus, as the second Adam, was more like a carbon copy of Adam. He was sinless as much as the original, pre-lapsarian Adam. Adam and Eve were created in the image of God, while all their descendants were created in the image of Adam, in "his own likeness", that means they were born as post-lapsarian sinners. As long as Mary and Joseph descended from Adam and Eve, they were not sinless.