GS had already arranged to be "bailed out" by Warren Buffett. They took the TARP money because the government made it mandatory to do so (so banks that needed it wouldn't be seen as weak in the marketplace). They simply sat on it, then repaid it with interest
$5 billion is peanuts compared to the amount of money being lost during that period, but of course it is impossible for outsiders to tell for sure if GS needed the TARP money, there were strong signs that say yes.
Warren Buffet only invested $5 billion into GS. Look at their cash flow here: http://www.google.com/finance?q=NYSE:GS&fstype=ii
$5 billion is peanuts compared to the amount of money being lost during that period, but of course it is impossible for outsiders to tell for sure if GS needed the TARP money, there were strong signs that say yes.