You would want to include transport costs, as those would be by far the largest component, at least to begin with. It would be unfeasible to send the entire weight of the colony from Earth anyway. Nonetheless, you would probably want to send at least initial ample supplies of food, water, oxygen and some very dense power source (nuclear reactors are the best available, at the moment) simply to get the colonists started.
There are several sources of costs that you must incur just to get and survive on your way there:
- Cost of producing the components used or consumed as part of the core
mission (trained crew, food, air, water and shelter for humans, energy for all the
machines to be operated, various probes, robots and tools).
- Cost of manufacturing the non-fuel parts of the means of transport to get you there.
- Cost of fuel required to leave the Earth's massive, crushing gravity well. Since each bit of (on-board) fuel needs to lift itself
in addition to the payload, this escalates super-linearly with
- Cost of fuel required to break and achieve a controlled descent through the destination's gravity well at the end of the mission
(can sometimes be partially alleviated by aerobreaking -- using the
atmosphere if it exists as a breaking mechanism, but this would not
work on the moon)
Now your establishment and maintenance costs will be very hard to calculate, since you didn't specify any of the assumptions you wish to work under? Would it be a single person, a few dozen, or thousands? Should we assume current technology? I'm not sure we even can establish permanent bases at all with current technology. Even the international space station, for instance, leaks a huge amount of gas into space, and new cylinders have to be brought in to compensate for the loss. The cost of shipping food from Earth for a permanent colony on the Moon or Mars would be prohibitive, given that a human eats between 400 kg and a metric ton of food per year, so depending on your planned population it would be a constant stream of expensive rockets.
Now, add a few tech ingredients to the mix, and the potential costs fall. The lowest hanging fruit is advanced 3D printing: it can make a lot of tools on demand (so you don't need many redundant replacement copies), and make them sturdier than normally constructed ones while also using less mass (so you don't have to push as much stuff up our gravity well).
Next, if you give your colonists the ability to use local resources to produce air, water, food and fuel, the stream of costly resupply decreases dramatically. But to do that, you need advanced nuclear power reactors, hydroponics, industrial extraction equipment, smelters, an entire industrial edifice that must be sent there. We don't know how to make most of this stuff work reliably outside our atmosphere.
Now you can go further into future tech and cut down the costs further, such as fusion reactors (ample fuel on the Moon), space elevators (launch costs fall 10-100 fold),
or go all out and assume self-replicating nanotech assembly which is a bit like a magic wand.
In summary it's not a question that can be answered without specifying a full set of assumptions you are prepared to make, and requirements on the size of the colony, the permissible fatality rate, allowed radiation dosages, whether the colonists are there permanently or hope to return, etc.