Louisiana Purchase was $15 million in 1803.
Alaska Purchase was $7.2 million in 1867.
Inflation puts $15 million in 1803 as being $19.6 million in 1867. So that puts Alaska purchase as 36.6% the price of Louisiana purchase. Honestly I can see why it was seen as a folly when the land couldn’t really be settled, crops couldn’t grow there, and the value was fur and fishing. (Though yes Louisiana as seen as a bargain).
They sold it because they knew they couldn’t hold it in a war. They also needed the money after the Crimean War. In any case they would have happily sold it for money during or after WW1 or during WW2 when they needed money.