I'd like to write a story about a man, who wants to buy the territory of a city (so basically the whole city), in the 1850-60s, because he discovered gold there and he wants to get everything. Maybe somewhere in Arizona, I couldn't figure it out yet, because I am completely lost in the topic, but I find the situation really interesting. Who "owned" the cities or territories back then? Could somebody buy things like that? I don't really know how should I imagine this. Thank you for your answers.
Kind of. I'm going to use Kansas for my example because that's what I've studied. Kansas is initially Indian Country (literally). It's sort of a reservation of reservations. Individual first nations have land allotted to them, frequently with borders that go to the Pacific Ocean or the Rockies. The borders usually are not surveyed because white people aren't supposed to be in Indian Country unless they're Indian agents, the military, or people moving along established trails to the Pacific coast.
The territory becomes open to white settlement by two processes, which operate somewhat in tandem. Territorial organization is the legal process by which territories are created. Congress passes an organic act (the Kansas-Nebraska Act, in our example) which establishes the territorial government and defines its boundaries. The territory cannot actually sell you land, but its legal presence (physical could sometimes take a while) permits whites to go out and squat on any land outside Indian reservations and places reserved for federal use to support military forts and such.
The second process is extinguishing Indian title. American Indians did not own their reservations, complete with the ability to sell the land. Rather they had a kind of title to the land as a tribe. Washington would task Indian agents and military officials to go to the individual tribes and negotiate the surrender of lands previously promised to them "forever". In Kansas' case, some of the tribes are asked to move for the second time because that's how white America rolls in the nineteenth century. Sometimes there's a swap for land further west. Sometimes it's just a straight reduction. One of the big negotiators for Kansas is George Manypenny.
Between the initial opening of uncommitted Indian country and ending Indian titles to land, a lot of space usually opens up. You can't buy it yet, but you can go there and stake out a claim. Actually living on the land is preferred, but optional. You can make prospective claims with the pinky swear that you will move there later. Sometimes people leave sticks with marks on them. I've read one case where a guy literally nailed a card to a tree. Wealthy people from adjacent states can and do hire people to go scout out and claim land on their behalf for later resale. This can be a lot of land in one go.
In theory, the territorial government is supposed to manage how this all shakes out. But courts are sparse and law enforcement similarly so. Most of it ends up being decided by the individuals on the ground, who will make appeals to custom and "squatter law". People actually there have precedence over absent speculators. In Kansas there's also a sense that people should be allowed two claims, one suited for agriculture and one with good access to timber. Courts may ratify squatter law later, but the decisions are largely made in the local community.
So say you found a parcel of land that looks like a good spot for a town. You probably can't afford all of it, but you and a few neighbors might. The done thing in this case is to form a town company, a legal organization that can sell shares of itself and then uses the cash to buy the land. Claims can be sold for shares and then the town company will take things onward. If the town succeeds, you get profit. Town companies sometimes do promotion in the form of funding newspapers or placing ads in papers from points east and invest in infrastructure like ferries (bridges come later) and sawmills.
If you're rich enough, you can potentially skip the town company. Either way, this is pre-homesteading. The legal process is preemption, by which the national government agrees to sell land at a fixed, lowish rate. The real obstacle would probably be other people around who don't like your speculation and ignore your claim or seek to violently dispossess you. Everything can be relatively fluid until the surveyors come through. Then squatters would make adjustments, which can cause its own set of controversies. I've looked into one case where they contributed to a couple thousand proslavery people coming across from Missouri to raze Lawrence (antislavery) to the ground, which they came fairly close to trying. Except Lawrence had fortifications and about 800 men with guns ready to argue the point.
Which is all a long way to say that you probably couldn't buy up an existing town in one go, unless maybe the town company agreed to let you buy them out, but you could get a bit ahead of white settlement and buy up land that has a good prospect for becoming a town.
Sources
Bleeding Kansas: Contested Liberty in the Civil War Era by Nicole Etcheson is the present standard work on its subject. The previous close history of Bleeding Kansas is Alice Nichols book of the same name, which isn't bad for a book from the Fifties written by a non-expert journalist but has a fairly strong anti-antislavery tilt.
The Howard Report contains extensive testimony about conditions in early territorial Kansas, including that big dust up. People who testify in Lawrence are usually antislavery. People who testify in Lecompton are usually proslavery. The relevant testimony is for the murder of Charles Dow and the Siege of Lawrence. The Congressional committee that went out there took testimony under oath and had a known antislavery majority, which sometimes leads to very evasive witnesses. The F.M. Coleman in the contents is the guy who killed Dow.
George Douglas Brewerton's The War in Kansas isn't so great on its own for the low-level stuff, but has accounts by many principals. Brewerton leans somewhat proslavery and pro-territorial government. If you like nineteenth century humor, Brewerton has a lot of it. He can be droll.
The Conquest of Kansas by William Addison Phillips discuss the event and in the process talk about the prevailing squatter customs. Don't confuse this William Phillips with the other William Phillips who was also antislavery and got shot dead in August of 1855...which I have done. WAP was an intimate of the antislavery leadership and wrote for Horace Greeley.
Lastly, this letter from Marcus Parrott to his brother discusses some of his prospective land speculation, though it spends more time on another effort by proslavery forces out of Missouri to wreck Lawrence. Marc's law practice was not paying the bills and he would like for some cash to be sent, thanks.