Read Luke which is Mary's genealogy. Mary's bloodline is also to David. The father can be a Gentile but if the mother is Jewish legally the child was considered Jewish in the Temple IIRC. Case in point Paul was Jewish but also a Roman citizen because his father was a Gentile {Roman}. Luke gives Mary's genealogy for Temple purposes. Matthew gave Joseph's genealogy for Tax purposes.
I don’t see any difference. The line is still through Joseph.