Scholar Bruce R. McConkie wrote:
Mary’s ancestors were the same as Joseph’s. She was a descendant through the royal line of King David. “Matthew says Joseph was a son of Jacob, and Luke says that he was a son of Heli. It appears, however, that Jacob and Heli were brothers and that Heli was the father of Joseph and Jacob the father of Mary, making Joseph and Mary first cousins with the same ancestral lines”
(Primary source: The Mortal Messiah, 4 vols. [1979–81], 1:316).
Matthew 1:16 states:
16 And Jacob begat Joseph the husband of Mary, of whom was born Jesus, who is called Christ.
Luke 3:23 is sometimes taken as a statement about Mary's lineage:
23 And Jesus himself began to be about thirty years of age, being (as was supposed) the son of Joseph, which was the son of Heli,
Were Jacob & Heli related, (potentially) making Joseph & Mary cousins?