How do I remove a Service Provider Lock from a mobile phone? (tying the phone only to SIMs for that provider).

I suspect there is a code to type in. But the service provider are probably unlikely to tell me what it is. I've noticed there are third-parties who can unlock a phone for me - for a fee. How do they obtain the code?

I imagine treacherous employees, secret meetings, and suitcases full of money

Or do they have a device that cycles through codes?

Or is there some way to reset a phone to factory settings? - clearing the lock.

The particular phone I'd like to unlock is a Nokia 3315.