The cost of groceries has been rising at the fastest pace in decades since the coronavirus pandemic seized the U.S. economy, leading to sticker shock for basic staples like beef and eggs and forcing struggling households to rethink how to put enough food on the table.