No, stockpiling food is not illegal. It is only illegal to stockpile certain types of foods which are determined by the government.