The cost of living in June was higher than expected, moving to levels last seen two years ago.