Looking in the charts in the tips and notes I see that in Romanian, as in French the possessive adjective or pronoun in the 3rd person singular can mean either "his" or "her" (and presumably "its") . It is the thing possessed that determines which form to use. So "sa" is feminine singular because "cartea" is feminine singular. And only context will tell the gender of the possessor.
And apparently despite "ei" meaning "he" as a nominative pronoun, it means "her/hers" as a possessive. There is a similar situation in Afrikaans with the genders reversed. "sy" means both "she" and "his"
"Ei" is the plural masculine nominative for "they" - it is also a way to say "her" when the object "owned" is masculine singular, another way being with the word "sau" (that letter "a" is with the breve accent). But I am just shooting from the hip here; maybe someone else can enlighten us with some definiteness.