While your answer is grammatically correct, it's not logical. When you use the expression "By the time X happened, Y happened" the focus is on Y, not X. This establishes some kind of significant relationship between X and Y, and provides a time frame for when Y occurred.
By the time the police arrived, the criminals had escaped.
In this example, we are more concerned about the criminals getting away than the police arriving. If you reverse the order, it doesn't really make sense:
By the time the criminals escaped, the police had arrived
Here the focus changes to when the police arrived, which seems odd, because there is no significant relationship between the criminals escaping and then the police arriving. One didn't cause or affect the other.
That being said, your confusion is justified, because the exercise is flawed:
Tony knew what the answer was after reading the book.
First, Tony read the book, and then, after he was done, he knew the answer. Yes, of course Tony had been figuring out the answer while he read the book. But the sentence itself is very clear about when he was certain of the answer.
There really is no 100% correct way to rephrase this starting with "By the time". I would imagine any other examples from the site you link may be equally suspect.
The idiomatic phrase is to take the time to do something which means:
to spend enough time to do something well or carefully:
- She didn’t even take the time to say goodbye. (Cambridge)
Gngram finds no instance of "take (the) time visiting".
However, you can certainly spend (some) time doing something:
To "spend time ___ing" means to use your time to do it. You use the
word "spend" with time because we think of time as being very
valuable, just like money.
- We spent the first month just debating what to call ourselves. (Phrasemix)
Best Answer
It does not exactly mean "we were best friends when we parted", since "best friends" usually implies a long-term friendship. "We parted the best of friends" means that "we were on excellent terms when we parted". "Best of friends" is used as a slight exaggeration, since the phrase is usually applied to situations where the speaker might have wound up in a less friendly relationship. For instance, if two people are rivals and they meet to work out their differences, the situation could turn ugly if they don't find a compromise that works. If they do reach an amicable agreement they might describe their final relationship as "parting the best of friends". It's not that they are really close, it's rather a way to contrast the alternative parting - as enemies.