Preinstalled software, that comes with a Mac, when you buy it, does not belong to you, and you cannot sell it. Have a look at the Licence Agreement: See this link: http://www.apple.com/legal/macapps/stdeula/
I underlined some important words:
a. Scope of License: This license granted to you for the Licensed Application by Licensor is limited to a nontransferable license to use the Licensed Application on any Apple-branded products running iOS (including but not limited to iPad, iPhone, and iPod touch) (“iOS Devices”) or Mac OS X (“Mac Computers”), as applicable (collectively, “Apple Device(s)”) that you own or control and as permitted by the usage rules set forth in the Mac App Store, App Store and iBooks Store Terms and Conditions (the “Usage Rules”). This license does not allow you to use the Licensed Application on any Apple Device that you do not own or control, and except as provided in the Usage Rules, you may not distribute or make the Licensed Application available over a network where it could be used by multiple devices at the same time. You may not rent, lease, lend, sell, transfer redistribute, or sublicense the Licensed Application and, if you sell your Mac Computer or iOS Device to a third party, you must remove the Licensed Application from the Mac Computer or iOS Device before doing so. You may not copy (except as expressly permitted by this license and the Usage Rules), decompile, reverse-engineer, disassemble, attempt to derive the source code of, modify, or create derivative works of the Licensed Application, any updates, or any part thereof (except as and only to the extent that any foregoing restriction is prohibited by applicable law or to the extent as may be permitted by the licensing terms governing use of any open-sourced components included with the Licensed Application). Any attempt to do so is a violation of the rights of the Licensor and its licensors. If you breach this restriction, you may be subject to prosecution and damages.
In the iLife applications iPhoto or GarageBAnd I am seeing the additional paragraphs in the license - in GarageBands "About" panel:
3. Transfer.
A. Apple Software obtained from the Mac App Store is not transferable. If you sell your Apple-branded hardware to a third party, you must remove the Apple Software from the Apple-branded hardware before doing so.
B. For any preinstalled Apple Software, you may make a one-time permanent transfer of all of your license rights to the Apple Software (in its original form as provided by Apple) to another party, provided that: ℹ the Apple Software is transferred together with your Apple-branded hardware; (ii) the transfer must include all of the Apple Software, including all its component parts, printed materials and this License; (iii) you do not retain any copies of the Apple Software, full or partial, including copies stored on a computer or other storage device; (iv) you have not associated the Apple Software with your Mac App Store account as set forth in Section 2B; and (v) the party receiving the Apple Software reads and agrees to accept the terms and conditions of this License.
So, point out 3 B. to the previous owner. Only the previous owner can request that the iLife apps will be transferred to your AppleID. This has to be done with the help of the AppStore Support.
And it is only possible, if the previous owner did not accept the iLife applications to the AppleID. Speak to the previous owner of the Mac, if the iLife apps have been associate with the AppleID. Then they cannot be transferred.