The narrator met the man and his wives, so they were coming the other way. The only person going to St Ives was the one telling the story. Do the sum anyway and you get 2,800 kits, cats, sacks and wives.
As I was going to St Ives, I met a man with seven wives. Each wife had seven sacks, each sack had seven cats, each cat had seven kits. Kits, cats, sacks and wives, how many were going to St Ives?
Give me a hintThe hint
Read the first two lines again. Who was going which way?