This is a really good question, you have to be intelligent to see the trick. The point is that it takes the boy 1 hour to walk home because he is walking at a rate of 3mph for 3 miles.
If the dog is running at his rate of 5mph for the same amount of time as the boy is running . . . can you see where I'm going with this?