A soldering iron has to meet several specifications, beyond getting hot enough to melt solder
- it must not electrocute you, so must be isolated from the mains
- it must be physically strong
- it must get hot quickly enough to be useful
Obviously some of these requirements are more important than others. You cannot tolerate an iron that kills people, but waiting for it to heat up is a compromise some people will accept if it's cheap enough.
There are two main ways to meet these requirements.
The first uses a heating element made of long thin floppy wire connected directly to the mains. For isolation and strength, this is wound onto an insulating former, wrapped in an electrically insulating sleeve, and then further sleeved in a strong, earthed metal tube which heats the soldering tip. This pattern takes a long time to bring the tip up to soldering temperature, as there are so many components to heat up through electrical insulation and additional interfaces.
The second uses a heating element made of a short thick wire, which is strong enough to be used as the soldering tip. This cannot be connected directly to mains as it's far too low a resistance, and it needs to be isolated from mains. Fortunately a transformer solves both problems with a single component. The cost of the transformer can be traded off against the advantage of rapid tip heating.