Some communities lack true grocery stores within walking distance, and residents lack the financial means to take buses, gas, or drive. However, there are convenience stores and fast food restaurants nearby, so that is where they get their food. Obesity and malnutrition can exist in the same person.
Processed and convenience food manufacturers conduct extensive study to determine what ingredients will entice the brain to crave their products - the appropriate quantity of fat, sugar, and salt, crunchiness or meltiness, and so on. Addiction is based on real research.
Many people do know better and could do better in many circumstances. However, it is not the only factor leading to the growth in obesity in Western nations.