SpaceX is and always has been funded by NASA. Congress simply doesn't allow NASA to do its own missions any more so it's been forced to add a middle man where it pays private companies to use its technology, infrastructure, and money to do the work it wishes it could do itself