I'm confused as to when you should use the word "ankaufen" in the context of buying something. Can someone explain the distinction?
Ankaufen is a special case of kaufen. It means that you buy something with the intention to resell it or expect to draw benefits in any way from the purchase. It indicates that the story is not over after the Ankauf. The action of investing money is more important than the actual object, and the investment is considered temporary (even if made for a longer term).
Typische Beispiele für einen Ankauf sind Wertgegenstände, Wertpapiere, Immobilien und Grundstücke. Natürlich kauft man immer, wenn man etwas ankauft. Umgekehrt ist es nicht so. Ein Auto wird vom Autohändler angekauft (also gekauft), vom Kunden (Benutzer oder Endverbraucher) wird es gekauft (aber nicht angekauft).
Ankaufen ist Untermenge von kaufen (welches das Gegenteil von verkaufen ist) und oft komplementär zu einkaufen.
„Kaufen“ is just the normal purchase, so whenever you buy something you say „kaufen“.
„Ankaufen“ is usually used in business environment.
If an antique shop buys old furniture to later sell it again, then you use „ankaufen“.
Another example would be the gold dealer buying nuggets from the prospectors to sell it to the jewelry makers.
As a private person you usually do not use the verb „ankaufen“ unless you plan to sell whatever you bought instead of using it yourself.
Ankaufen emphasizes, that the other party pays the money and you are in the seller position. It is typically combined as in a shop for used cars, which offers An- und Verkauf (so they don't just sell you a car, but would also make you an offer for the one you have).
Goldankauf as other (increasingly frequent) example: you may bring coins or jewellery to the shop and they pay you for the weight of the gold.
Goldkauf in contrast would just indicate a "trade with gold", but not in which direction.