From your information, it would be sure that foreigner is allowed to purchase house in Shanghai though he has no resident permit in China?
Could the foreigner purchase any house in Shanghai? I heard that, in the previous time, only those houses with special certification from the government could be sold to the foreigners.
I might bother you with more question later on.
I currently live in Beijing. Sorry that I might not be able to be your tutor on HSK. Why not pose message on some BBS, e.g. Fudan University BBS.