With out buying new extension, possible to build own extensions for automatically adding free product along with purchased product in cart or possible to change existing code for this functionality in default community edition 1.9.
Yes, that is possible. You should customize Magento to add that custom feature.
If you want to avoid buying an extension, you can download the following extension for free, which is compatible with Magento 1.8 and see if it works properly in the latest Magento version: