Basically to clarify when did countries stop invading each other to get land and start selling it to one another?
Your understanding is pretty much incorrect.
First off, the entire idea of land being firmly and incontrovertibly owned by a particular sovereignty, with concrete territorial boundaries marked off, is roughly speaking a modern idea associated with what is commonly called "Westphalian sovereignty", after the Treaty of Westphalia of 1648. "Westphalian sovereignty" is when a ruler of a territory argues they have comprehensive, exclusive control over a specific, marked-off territory; many people cite Max Weber's later definition that a national sovereign in this mode of authority has to have a "monopoly on violence" within the territory.
Prior to this point, most existing states, empires and polities in world history held territories in shifting and flexible ways. Often their claims to territory were informal and negotiable. They might claim some tax revenues, assert some rights of movement and power, but not insist that they had comprehensive authority over the inhabitants. So territories all across the world passed in and out of direct control by rulers. In a premodern context, rulers who identified land they wanted, invaded it, and most crucially kept it, are pretty rare, no matter where we're talking about. An invader might claim territory or rewards, but keeping that new conquest as part of a coherent new polity was a much less common event, and arguably a decent number of invading or conquering leaders didn't expect anything except tribute, etc.
Even in a pre-Westphalian context, the mechanisms by which sovereigns (of a great many kinds) could expect to increase their territorial authority on a permanent basis were extremely diverse. Marriage or kinship alliances were a fairly common mechanism all around the world. Treaties or agreements were another (certainly in some cases coercive). Migration--or emigration--that changed the linguistic and cultural balance in a particular territory, and its loyalties to various sovereign powers, could sometimes (usually over centuries) change who was considered to be in possession of it. And there are premodern examples of money changing hands, more or less, and allowing a sovereign in one place to command authority of another.
The OP might also take note that it's not clear that relatively contemporary modes of territorial acquisition are effective or permanent. Only 150 years ago, "countries stole land to absorb into their empire" in Africa and Asia; several centuries before that in North and South America. But only a relatively short time ago (the 1940s-1960s) many postcolonial states were created that involved some degree of forcible recombination of territories that didn't necessarily identify with one another--processes that are still very costly for us today in many respects. It does not seem that the idea of "stealing land" through invasion is totally absent today. Moreover, I'm actually pretty hard pressed to think of an actual example in recent years of a current nation buying substantial territory from another territory and having the transfer of territory happen in an amicable and accepted way. So in that sense I'm not even sure what the OP is thinking of.