SpaceX's website pegs the cost of a Falcon Heavy at $90 million. That number will get repeated a lot as the demo flight draws closer, so it's important to note it comes with some caveats. Buying a rocket is a little like buying a car: extra trim levels and extended warranties add up quickly and frequently put you above the starting price.
Case in point: Space Test Program-2 (STP-2), the Air Force launch that will carry multiple payloads to three different orbits, including The Planetary Society's LightSail 2 spacecraft. The Air Force will actually end up paying SpaceX a maximum of $160.9 million for that launch, depending on the completion of various milestones leading to launch, including mission success.
Here's why. First of all, there's oversight. The government requires its rocket providers to present lots of reviews as launch preparations progress. At those reviews, the provider updates Air Force officers and contracted, subject matter experts from organizations like The Aerospace Corporation on how things are going. If there are problems, deeper investigations may be required.
Secondly, STP-2 is a complex mission. 25 different spacecraft will be deployed into three different orbits. In addition to providing the Falcon Heavy rocket itself, SpaceX is responsible for designing and building the adapters to hold all those spacecraft inside the rocket's payload fairing, and also making sure they get deployed at exactly the right moments.
On STP-2 launch day, the Falcon Heavy will first place 12 satellites into an initial low-Earth orbit, before transferring to a circular, 720-kilometer circular, low-Earth orbit to deploy a constellation of six identical satellites called COSMIC-2, along with five smaller auxiliary payloads. (One of those auxiliary payloads is Prox-1, containing LightSail 2).
Then, the Falcon Heavy upper stage re-ignites and flies to an elliptical, medium-Earth orbit (12,000 by 6,000 kilometers), where it will drop off another spacecraft called DSX. After that, there's an Air Force certification objective to show the upper stage can coast for at least three, and ideally five, hours, before restarting for another five-second burn. To pull all of this off, SpaceX has to carefully configure the Falcon Heavy's flight software and test it to make sure it all works.
Even with all those extra options and requirements, the Falcon Heavy is still cheaper at $160.9 million than its competitors. A Delta IV Heavy flight can cross the $400 million threshold, and SLS will be even more expensive. (At one point NASA was hoping to keep the cost of an SLS flight to about a half-billion dollars, but that estimate has grown—how much depends on who you ask.)