This is explained in Chris Anderson's book Free: How Today's Smartest Businesses Profit by Giving Something for Nothing.
Well sometimes things actually are free, someone's just hoping you'll buy stuff later. If you have not I recommend you read this book https://www.amazon.com/Free-Smartest-Businesses-Something-Nothing/dp/B0043RT912
It is extremely interesting. It's about the practice of giving away things for free to encourage stronger customer relations and sales in the future. Examples include bands putting their music up online for free, games being "free to play," etc.