Buying property and having a NIE are too different issues. You sure can buy property being a non resident. You need to take precautions as the ones described in the article chica posted.

On the other hand,the NIE is the identificación card number equivalent to the DNI the spaniards have.

When you are granted permanent residency you enter in the national identificación system, which they will assign you a NIE which represents the full information on your person.