iPhone to iTunes application transfer
1)your friends itunes account was probably registered on your phone when you synced with the computer.

2) you can only be synced with one itunes account at a time. your problem might be that your synced with your friends account so any app that you download with your account wont be able to sync any apps unless you change it to sync with your account(which will delete all apps not purchased with your account.)