Making a loss to begin with is okay.
You may actually want to reduce taxation in the early game to encourage population growth, and avoid adding factories and things until you actually have the economy to support them - because as well as costing money in maintenance, you actually have to pay for all that production.
You need to grab some of the habitable planets out there, despite the financial hardship they may cause you, because when their populations grow they will become prosperous. You can also speed things along a little by sending a colony ship to an already colonised planet, dumping the population on it, and re-launching with just 1M colonists (so a net increase of 249M).
All production (Social, Military or Research) costs money, and bonus production (from abilities, planetary or starbase boosts) costs half the usual amount. You can cut back on Social or Military spending by not building anything on particular colonies, allowing you to fund the starport or building construction you actually need.