The commonality of genes between diverse species has, besides inheritance, another possible source: "horizontal gene transfer". Bacteria can introduce genes into their hosts, and retroviruses are known to carry genes between animals of the same species (and may carry genes between species as well).
Ref: T.A. Brown, Genomes. Wiley, 1999.