The primary purpose of electrical tape is to insulate wires after they have been spliced in an approved manner. The US National Electrical Code permits splices to be made in various ways:
110.13(B) Splices. Conductors shall be spliced or joined with splicing devices identified for the use or by brazing, welding, or soldering with a fusible metal or alloy. Soldered splices shall first be spliced or joined so as to be mechanically and electrically secure without solder and then be soldered. All splices and joints and the free ends of conductors shall be covered with an insulation equivalent to that of the conductors or with an identified insulating device.
So if you really want to, you can wire your house by twisting the wires together soldering them and taping them with electrical tape. I have actually seen this in old houses. But nowadays you will find it easier, quicker, and cheaper to use readily-available wire nuts. (A wire nut would be a combined "splicing device" and "insulating device".)
Electrical tape is still widely used when splicing larger conductors which are too big for wire nuts. Often splice bolts are used. These are bare metal clamps which bite down on both wires. Once the bolt is installed it is wrapped in multiple layers of tape. You can often see these splices at the service entrance where the wires from the street join the cable leading down to the meter.
The reason electrical tape may not be used to splice a lamp cord is that splicing of such cords is not allowed at all (NEC 400.9).