SpaceX funding comes from the members of ESA. The member countries are proportionally awarded contracts developing things for ESA in return.