A benchmark measure of inflation slowed in July after surging in the previous month, offering a glimmer of hope that the painful inflation Americans are facing could moderate in the coming months.