Is that possible to change IMEI on Iphone 5? I know changing the IMEI number of the phone, is illegal in most countries.

I'm basicly curious about two things:


Is that possible?
If it is not possible; why is that so hard, technically? (Considering the fact that it is written somewhere in the phones memory.)
Apart from the fact that it is illegal (in most if not all countries), you might want to think about why you would ever want to change the IMEI on your phone. I can think of only a few reasons why you would want to do that: 


clear the identity of a stolen phone
clear information about phone manufacturer and model
research


Numbers 1 and 2 are highly questionable I would say. But to answer your questions: 


Depending on the phone it could be possible, unless a one time programmable chip is used to store it, changing the IMEI would mean changing that chip, and since that's usually baked on the phones motherboard, it requires you to change that completely then.
Why is it made so hard? Well to prevent you from clearing the identity of a stolen phone mostly.


Consider the IMEI of your phone the same as the chassis number of your car, why on earth would you want to change that, unless you have criminal intent?