I recall reading that the Americans were originally only interested in buying New Orleans from the French, and were confounded when the French offered them the entirety of what remains of their territory in North America, which then led to the doubling of the size of the USA. Correct me if I'm wrong, but I read that on average, the Louisiana purchase cost about a few cents per acre of land.
Why did Napoleon agree to such a sale? Couldn't he at least have raised the price of the land to get more profit?
France hardly owned Louisiana at the time they sold it. They had acquired it back from Spain only in 1800, so it was not so painful to give up again.
Strategically it would have been impossible for France to defend it in the long term anyway, so selling it made sense. American attitudes were pushing them to a hostile stance towards France, and the British were already on the path to war with France as well. France would have had a difficult time defending the Louisiana territory from them.
France's continental aims were more important from a safety and stability point of view and they couldn't really spare the troops for a war across the ocean when they were fighting on the mainland. Owning territory that generates most of it's revenue from slave labor was also difficult to justify in the Revolutionary France where all men were free.
Had he waited much longer for the sale Britain would have likely invaded and claimed the territory via Canada at some later date since they were inevitably going to war, and America would have likely joined in as well as long as there was territory to take and they were hostile with France. The sale gave him a few more years of peace and money. Had he waited he would have had neither.
Follow up question:
Was there any chance of an British-American alliance (rather than the War of 1812) that would have taken this territory by force (and given in to America), in exchange for US support for Britain in the Napoleonic Wars? In retrospect, it would have benefited both countries considerably. The US would have avoided a war it lost. Britain would not have had to waste resources fighting the Americans, and Napoleon would have been denied the millions he received for the purchase.
And seems natural, being allies for such a long period since.
I understand that the Jefferson and Madison were both more sympathetic to France rather than Britain at the time.