Is it illegal to talk to foreigners about real estate?

It's not illegal.

Baidu Encyclopedia says that breaking the law is a general illegal act and will bear civil or administrative responsibilities, but talking with foreigners about real estate does not violate any laws.

Real estate is a comprehensive and complicated concept. Physically, it is composed of buildings and land. Land can be divided into undeveloped land and developed land. Buildings are attached to and combined with the land.