How did the lineage of Cain come through the flood?
We find that information in Abraham 1:23-24:
“The land of Egypt being first discovered by a woman, who was the daughter of Ham, and the daughter of Egyptus, which in the Chaldean signifies Egypt, which signifies that which is forbidden;
“When this woman discovered the land it was under water, who afterward settled her sons in it; and thus, from Ham, sprang that race which preserved the curse in the land.”
A few thoughts on that however: First, we know that Noah cursed Ham, (Genesis 9:25 “And he said, Cursed be Canaan; a servant of servants shall he be unto his brethren.”) and it is possible that the above preservation of the curse in the land means that curse rather than Cain’s curse. However, as this curse from Noah occurred after the flood, it makes more sense to me that “preserved” is referring to having been preserved from before the flood, and therefore more likely to refer to the curse of Cain.
The Guide to the Scriptures entry on Ham on lds.org also draws the conclusion that, “Ham’s wife, Egyptus, was a descendant of Cain.”
Also, just so we are clear, the Church has disavowed the notion that this cursing of Cain and/or Ham has any relation to the modern Church’s priesthood ban (see Race and the Priesthood).