In terms of total gold spent, there is no difference between buying the components of an item and then buying the finished product or just buying the finished product from nothing.
You do have to purchase the completed item at some point. Buying all the components does not automatically grant you the completed item. Some items have the exact same components (boots being the prime example), so it wouldn't really work to have an automatic upgrade like that. You will also notice that the total price is greater than the sum of the prices of the components. This additional cost is referred to as either the combine cost or recipe cost on various sites and in the patch notes.
Remember that when you buy a finished item, any components you have in your inventory will be removed. This means that if you want to buy another item using the same component, you will have to buy the component again. For example
all have
as one of their components. If you want to have all three of those finshied items in your inventory, you will have to buy three BF swords along the way. You do not have to explicitly buy each of the individual components of every item you want. If you have enough money to buy a completed item, the game will effectively "buy" the components for you and instantly combine them into the bigger item. This becomes very relevant later in the game as your inventory starts to fill up and you would not have room to hold each of the components while you are building the item.
As a side note, items being removed from your inventory is different from you selling an item. Selling an item does not give the full gold cost back, but the full gold cost of an item is counted against the total cost of an item, as Cujix explained in his answer. Do NOT sell a component when you are ready to combine it into something bigger.
There is one major advantage of buying component items along the way to a finished product. You can get some of the stat boosts now and get the rest later. So if you want an
but are back on the fountain with only 1300 gold, go ahead and buy a
and get 40 AD now and upgrade to Infinity Edge when you get another 2300 gold to get the rest of the 70 AD + 20% crit chance + 50% crit damage.
This advantage does come with one possible downside. You can only hold so many items, so if you start building components for several different finished items, you may run out of space and have to accumulate a large amount of gold before you can continue upgrading. In the end, you will have the same stats for the same total gold, but along the way, you will have a period of time where you are weaker because you have a lot of unspent gold that is providing you no bonuses yet.