Yes it is legal but will void your warranty.
It usually isnt hard but some models are harder to do than others. Most you can just enter the correct code, others you need a cable but still easy enough to do.
Yes they are made for certain carriers but if you have a phone with a SIM card in the back under the battery you can unlock it to use with another carrier. Like with ATT. When they went to cingular I didnt want to switch so i just bought and unlocked phones and put my card in to use. It is also done with TMobile phones. Now there are a few other that have sim cards too.
hope it helps :-)
Linkback: http://hackitz.com/smfboard/index.php/topic,39.0.html