Stations are better for sure.
Gravity well
In both cases, to be able to inhabit another planet or to build a space habitat humans have to leave the gravity well of their planet Earth. The challenge is the same in both cases in terms of transporting humans and their initial supplies.
Systems like SpaceX ITS can be used to solve the problem of exporting humans into space and it can do it for any purpose - a planet, a moon, a space station.
Building material
A planet may offer some advantages by offering building material for the price of energy of extraction of those materials(and transporting, and processing and ...). A planet as a source of such materials - is a big source of them, but not infinite or super good.
As an example, if we use a layer 1km thick on a planet like Earth for our constructions it will be 486'922'800 cubic km of materials - a number of materials which is equivalent to a dwarf planet with a diameter of 990 km.
But as we can see there would be problems in doing that on a planet if people live close to the surface(or on the surface).
On the Earth, a human can live under a rock and call it home - so we may say on Earth(and only there) a human do not need a lot of materials to build a home.
On a planet like Mars, material demands are higher than on Earth, everything (especially first few thousand years, for those who would like to terraform the planet, until they wait for the results of terraforming) have to be built as an enclosed system, the same way as a space habitat.
On a planet, materials are laying around...
That is kinda true, but when we take look closer at the problem, as for example Mars, things begins to be not so good, still probably in favor of the Mars, but how much in favor it depends on, and we can't say so about any planet, or even about Mars, just because we do not know yet for sure.
Mars have water on its pole, but the problem is where it have water it means not good solar insolation, the whole Mars have a problem with that, but some places are worse than others. Some suggest solar to be the source of energy for the Mars colony, and for reason of solar to be more efficient, strategically it makes sense to place the colony near the equator. But it may be more efficient to place the colony in the middle, energy station on the equator, make power line from the equator to the station, from the station to the pole etc(because of transportation problems, because of other factors which have to be optimized).
The point is - to be on the planet it does not mean all needed resources are under the feet. Planets are usually relatively big, Mars circumference is about half of the earth (21'280km). Not all resources colonists may need will be in one place and it does not necessary mean only materials, energy, but also seismic stable region as an example, or better landing place or better relief etc, the list goes on. So even a small colony may need relatively long routes of transportation.
Real world example, with good roads a tesla car uses about 500 Wh per km to pull about 1.5-ton trailer(and its weight is about 2.3-tons), it is about 2 times of its typical consumption. Useful payload there is the trailer, so we need to spend 500 Wh on towing 2 tons per 1 km on a relatively good road(Norway). It means 900J to transport 1 kg per 1 km on a road. (On mars it is hard to use fossil cars, for obvious reasons.)
The Moon escape velocity is 2.38 km/s, and it have no atmosphere, so we may have a mass driver launch system there, and to launch 1kg from the Moon with a mass driver we have to spend 2'832'200 J per kg, to Earth orbit or to an orbit around the Sun(!). The energy is equivalent to transport the 1kg over a distance 3146 km. And I would not say that such transportations will be an unreal case for a Mars colony, I think such distances may easy have a place there. (Saw suggestion to use ITS for transporting stuff at the begin of colony building from one place on the planet to another, makes sense actually)
But on a planet, they do not have to transport all their material
True. To build a space habitat one has to transport all needed materials into the orbit, where the construction will be.
But how much? O'Neill estimation for the first colony are
The nominal values for the first model colony are taken as: construction force, 2000 people; population, 10,000; total mass, 500,000 tons. When the design and cost analysis are done in detail for the entire enterprise, the need to fit a budget may force some reduction in size. The initial estimates have been aimed at holding the cost equal to that of one project we have already carried through: Apollo. The choice of 10,000 as a target population ensures that, even with some reduction, Model 1 will be large enough to obtain economies of scale and to serve as an effective industrial base for the construction of Model 2. A much reduced colonization project would be little more than a renamed space station, perhaps able to maintain itself but incapable of building the larger models that are necessary if the program is ultimately to support itself. It is an essential feature of the colonization project that Earth should no longer have to support it after the first two or three stages.
O'Neill, G. K: The Colonization of Space, Physics Today, vol. 27, no. 9, Sept. 1974, pp. 32-40.
50 tons per human for the construction and I would say it is pretty realistic. It is ISS mass proportion, but as volume grows proportionally to the cube of linear sizes we get more results for a bigger colony than we have with ISS.
For those 50 tons per human you get:
Earth-like gravity
radiation protection
Earth-like climate
Earth-like ecology (potentially) without the need to wait for the end of terraforming a planet, which may take some time, and have some bad planetary scale consequences.
Most important, we will get an environment over which we have full control, and that is not possible to achieve at our current level of technologies on the scale of a planet, even with partial-limited terraforming(some kind of big dome) it might be close to what we may have on the space station but not quite the same, not 100%(planet soil, tectonics, winds, dust etc).
We also get the ability to choose the orbit for the space habitat, where to build it - on an orbit around the moon, on an orbit around the Earth, Lagrange points, an orbit around the sun(closer to the sun, closer to asteroids). We can't do that with the planets. Different places/orbits have different advantages. Closer to Earth, less delay in everything (connectivity, supply, help, human resources, teleoperating, services(buy/sell)). Closer to asteroids - matter in shallow gravity wells. Earth-Sun L1 - plenty of energy 24/7/365, 1360W/m2.
ITS projected to be capable of delivering 450 tons payloads to Mars surface, with the price of 140'000\$ per ton - so even if we do not think to make the building easier by establishing a manufacturing base on the Moon, the project(O'Neill cylinder, 10'000 population, 500'000 tons construction) may cost 70 billion for material delivered by SpaceX ITS.
A planet is not the Earth
We tend to think that we know how to live on planets because we live on a planet right now. The fact is, a planet it not the Earth. Surviving each planet or moon in the solar system needs the same amount of technologies as to get there.
With space habitats, we can't say we did that, especially at such scale, and it is obvious for us we have to reinvent and adapt our technologies for the station, and that is true, but the same thing we have to do with any other planet, and the only planet where we do not need to do the adaptation of technologies is the Planet, the Earth.
Inhabit a planet or build a space habitat, problems are overlapping in 90% cases if not all 100%. And the difference is in result we get after our efforts.
With space habitats, we get highly scalable and tunable system, with a planet we get a very inertial system where is hard to implement things and almost impossible to undone the things, hard to predict the results, etc - all sorts of problems. The inertia of a planet as a system might be a good thing, for sure is so for Earth(because we do not have to change things here, we have to preserve them as it is), but for all other planets it is exact opposite, we have to change them almost in every aspect of their presence(if it possible at all) and only real thing they may offer for our efforts is gravitational mass.
The Mars with a 1 million colony for research of the planet, or even 10 million for the task(or 100 million or whatever number is needed) - not a problem, welcome and get us the science. A second new home for humanity - no, I do not buy that.
Microgravity and Energy
Microgravity is a big advantage of space, especially near Earth orbit(let's say L1), especially in terms of producing energy and converting it to useful work.
Near Earth, there is a constant flux of 1360 W per square meter of energy, 24/7/365 - no clouds, no wind, no weight, no so much dust, a little bit of meteorites, constant angle of sunlight(if our solar station makes 1 revolution per year), no birds to preserve.
The system like a real example of a solar plant which works with molten salt as a heat carrier. Its life cycle intended to be 30 years, and it gets at least 4 times less energy than it would get at near Earth orbit. It is more massive(and it means more energy was spent to build one of such) because it has to be robust to its own weight, winds and all forces which would be applied to it during those 30 years.
It could be replaced by just a top of the tower and energy producing machinery and with aluminum foils floating nearby the system guided by such ion microthrusters or another light weight tether-like, umbrella-like construction, which could significantly reduce the time it returns the energy spent on its construction, even with lifting materials from a gravity well.
Notes
Another reason why people think about planets, they think they will deliver colonists, and after that will be a business as usual, and we do not need rockets anymore. But why not. SpaceX works on reducing the price trough re-usability. But it is not the only way to reduce the price of rockets, cheap energy is also one of the ways to reduce the price of the production, automation of the productions is also one of the ways to reduce the production price. Energy in space is cheaper, resources may be cheaper if we deliver them from the moon, so why not to produce them in orbit. It is not something which is impossible to do (as note - micro-gravity actually will help with precise machining, less distortion of machines, no need to be bulky, less energy to produce such machines, no vibrations from ground) - and if we do their production, why not to continue to use them - build a mass-driver on Ceres and it will supply with water -> LOX-LH2 millions of those rockets - why should we discontinue their use.
Materials. Production of aluminium costs us 54MJ per kg, and launching aluminium ore from Luna costs 8% of the energy we should spend to make actual aluminium from it. So the cost of launching it might be not a major factor in the cost of making something from aluminium, but the cost of the energy where it is processed is the major factor. This molten salt tower, if such will work on mars (it probably will not) it would probably work for 50 years to make some profit, and that do not helps with reducing the cost of converting raw ores into useful materials and production.
Relative concentration of various elements on the lunar surface