It's legal to the extent that the practice is condoned by government. Is it really legal? Well no more or less so than giving citizenship to children of illegal aliens which means, NO.