Inflation eased to 3% in June, its slowest pace in more than two years, but remained above the Federal Reserve’s goal.