NASA pays SpaceX primarily to put NASA satellites into orbit, or to send NASA cargo to NASA astronauts on a space station partially built by NASA. They provided some funding to help SpaceX develop that capability. They are continuing to fund SpaceX's development of Dragon v2 (because NASA also wants the ability to send NASA astronauts to the space station) and Falcon 9 Heavy (because NASA wants to improve what NASA satellites SpaceX can put into orbit). NASA is *not* directly funding BFR/BFS development, because they don't want that (the current BFR development was funded with the *profits* from the Falcon 9 flights, just as Falcon 9 reuse was). Note that NASA also pays United Launch Alliance, Orbital ATK, and Roscosmos for launch services, and has been funding development in Boeing, ULA, Orbital ATK, Sierra Nevada, and Blue Origin, all of whom are building things NASA wants to be able to buy one day.
The US Air Force and the NRO also pay SpaceX to put their satellites into orbit, and the USAF was among the early funders in SpaceX because they like having redundant means of orbiting satellites. I believe they are funding development of Falcon 9 Heavy in order to have a redundant means of orbiting heavy satellites. They are not funding BFR/BFS development because their job has nothing to do with Mars, unless the Russians start putting guns and soldiers there.