Phones are locked to a network because you are paying for them over the length of your contract.

If you bought a new Samsung PayG handset, it might cost you £500.
If you took out a contract for the same handset, it might cost you £20/month for two years.
It's roughly the same amount of money and that's how they work out which phones go on which tariffs.

Unlocking is easy enough - you can often buy a code from eBay for about a tenner.
Just read the instructions carefully, maybe watch a YouTube about how to do it before if you're nervous, check the feedback of the seller and away you go.
Could be done in minutes that way rather than faffing with a new sim.