It has almost nothing to do with shared environment in the wealthy first world countries we study this in. But malnutrition, disease, and other factors can certainly have large effects. The introduction of iodized salt in the US raised IQs by 10 points in certain areas where people's diets and water were sufficiently iodine-deficient.