True, carriers in all those countries sell iPhones with a SIM lock. But in Spain and France at a minimum, there is a service to unlock the phones upon request.
In France at least, whilst it is legal for a carrier to lock a phone initially, it is illegal for a carrier to outright refuse to unlock the phone when the customer asks for it. (Although, if the customer asks for it while they have more than 6 months left in their tie-in contract, the carrier has the option of charging a fee for providing the unlocking service; after the 6-month limit, the carrier must do it for free. In either case, the act of unlocking the phone does not release the customer from the obligation to continue purchasing service from the carrier for the remainder of the contract term.)