Why boys who inherit more genes of their mother are not born as girls and girls who inherit more genes of their father not born as boys?
Most genes are not male or female, so receiving more genes from a father or mother would not make a child more male or female. Whether a mammalian embryo grows to be male or female is pretty much determined by a single gene that's found on the Y chromosome. Called the "Testis-determining factor" (TDF), it triggers the development of male characteristics. TDF is a regulatory gene, and its effect is to switch on other genes, which result in the development of testis. All embryos would become female without the intervention of this gene.

The gene TDF is found on the Y chromosome. Male mammals have one Y chromosome and one X chromosome, females have two X. So there's a 50% chance a fertilised egg will inherent an X, and a 50% chance it will inherit a Y chromosome from it's father, which determines its sex.

References:

Testis determining factor, https://en.wikipedia.org/wiki/Testis-determining_factor

General info about sex determination in different animals (it varies a lot),
 https://www.nature.com/scitable/topicpage/genetic-mechanisms-of-sex-determination-314