A quick google search says that SpaceX charges 62 million for a typical Falcon 9 launch. Let's say they have a 50% profit margin (no idea if that's true, but let's go with it). They had 26 launches in 2020, so that's 806 million in profit they can redirect to R&D on Starship (in addition to loans or VC funding rounds or loose change found in Elon Musk's couch).
The Starship prototype cost is a big variable, but assuming it's somewhere in the (log scale) middle of the 10 to 180 million range it's not unreasonable to think that SpaceX can afford to keep producing these things at a rapid rate for quite a while without going broke.
The Starship prototype cost is a big variable, but assuming it's somewhere in the (log scale) middle of the 10 to 180 million range it's not unreasonable to think that SpaceX can afford to keep producing these things at a rapid rate for quite a while without going broke.