Do they? Or are things like food deserts transitive symptoms of deeper problems? E.g. that the surrounding area is poor and getting poorer. If so, no amount of legislation will change that
Programs like SNAP, the earned income tax credit, subsidized child-care, and refundable tax credits for children have an immediate impact. Legislation could also provide a universal basic income.
If that's too pink a set of approaches to reduce the impact of poverty for you, governments can also subsidize development of new housing and invest in infrastructure upgrades that draw folks with higher incomes into a community. This works best if you are in a metropolitan area. In rural communities, it's not uncommon to pour great sums of money into courting large employers, giving them land or tax free status for extended periods.
Hell, if your goal is just to get a grocery store, pour on enough subsidies and someone will show up to collect that money.
The more money there is to be made in the grocery sector, the more grocers there will be to compete for it, located in the places where the money flows. Likewise the leaner they have to operate, the more they'll shut down in marginal territory that can't support their business, and the more areas will go without convenient access.
If selling groceries in low-access areas for low profits is indicated by the necessity of food, then nobody is stopping you from doing it; but as the grandparent comment hinted, if you find your niche in high-margin software instead then you're following the money, just like grocers do.