Has there ever been a country that sold to another country (Government)?
In one sense this used to be very common. Any number of cities, provinces and whole states were transferred from one sovereignty to another by dynastic marriage. This was a kind of purchase - a transaction - or a trade as part of a dowry.
National identity is a relatively recent thing (the last couple of centuries). Prior to that, emotional identity tended to be more locally based. It was normal for states to have no geographical continuity, to be split up. For instance look at the crazy patchwork that was France in 1477:
Regions or territories of a country have been sold to other countries before. For example the Louisiana Territory was sold to the U.S. by France in 1803, this is known now as the Louisiana Purchase. However, I have never heard of an entire country selling itself to another, but there have certainly been hostile takeovers.