Consumer prices excluding fresh food rose 3.1% from a year earlier in July, slowing from a 3.3% gain a month earlier.