1

In Ki Tetze we learn that If one has two wives and the firstborn is of the hated wife, he still gets the double portion.

On this commandment, the commentary in the Artscroll Chumash notes that the Or Hachayim says that in the case of Leah and Rachel, Leah was the "hated" wife so God let her have children first to endear her.

Why then, does the firstborn of the loved wife (Yosef) get the two portions if one is not supposed to favor the loved wife over the hated wife?