That doesn't take into account that he had to put the extra 10.
It actually does. Let's say he start off with exactly $60. He buys the goat. Now he has $0.
Then sells the goat now he has $70. for a total of +$10 from his original $60 position.
Now he needs another $10 to buy the goat again for $80 so he borrows $10. Now he's up $20 from his original position but has a $10 debt he needs to pay back. We won't concern with the debt right now and just focus on what cash he has which is now $80.
With the $80 he now buys the goat and has $0.
He then sells the goat for $90. Currently he's up $30 from his original $60 position. He repays the $10 loan (assuming no interest) and is finally left with $80. $20 more than his original $60. Hence he made $20.