All Apple iOS devices have a model number which looks something like this: MC605LL/A. The MC605 is an iPhone 4, black, 32GB. You can find these numbers on the Models page. The two letters behind it, LL in this case, specify the region code. The following list gives an overview of all these region codes.
The region codes are probably used to separate the same device by region (different charger, packaging language, etc.).
It is not possible to see to what carrier the phone is locked (or not) by just looking at the model number, but it gives you an idea where the phone was intended to be sold.
It is also noteworthy that my iPhone 4 had a model number MC605FD/A (locked) and it was warranty-exchanged in a Swiss Apple retail store to a MC605B/A. The employee at the Genius Bar locked it with my SIM. I can prove that, because I intentionally gave him the wrong SIM to see if I accidentally get an unlocked replacement phone. When he activated it, it got locked to the "wrong" provider. When we noticed that, he had to get another replacement phone and lock it again to the "correct" provider. This means that even locked phones are initially unlocked and get locked to the carrier of the first inserted SIM. --http
The following list shows the possible region codes.
|AB||Egypt, Jordan, Saudi Arabia, United Arab Emirates|
|AM||United States (Assembled in Vietnam)|
|B||Ireland, UK, also used for some replacement units|
|BR||Brazil (Assembled in Brazil)|
|BZ||Brazil (Assembled in China)|
|DN||Austria, Germany, Netherlands|
|FD||Austria, Liechtenstein, Switzerland|
|LA||Colombia, Ecuador, El Salvador, Guatemala, Honduras, Peru|
|LL||USA, Canada, also used for some replacement units|
|LZ||Chile, Paraguay, Uruguay|
|MO||Macau, Hong Kong(?)|
|NF||Belgium, France, Luxembourg|
|X||Australia, New Zealand|
|ZP||Hong Kong, Macau|
More information here.