Peel and slice the russet potatoes into 1/8-inch rounds, placing them in a bowl of cold water to prevent browning—this is crucial for both appearance and texture. Dice the ham into 1/2-inch cubes and set aside. Slice the onion into thin rounds. Having everything prepped and ready will make the assembly process smooth and prevent the potatoes from oxidizing while you work on the sauce.
Melt 4 tablespoons of butter in a medium saucepan over medium heat. Once melted and foaming, whisk in the flour to create a roux, stirring constantly for about 1-2 minutes until it turns light golden and bubbles slightly—this cooks out the raw flour taste. Gradually whisk in the milk while stirring to avoid lumps, then add the salt, pepper, garlic powder, and smoked paprika. Continue cooking and stirring for 3-4 minutes until the sauce thickens enough to coat the back of a spoon, then remove from heat. I like to add the smoked paprika to the sauce rather than as a garnish because it infuses the entire dish with a subtle depth that complements the ham beautifully.
Preheat your oven to 375°F. Lightly oil a 9x13-inch baking dish or similar size. Drain the sliced potatoes thoroughly and pat them dry with paper towels—removing excess moisture helps them cook evenly rather than steaming. In a large bowl, combine the drained potatoes, sliced onion, and diced ham, tossing gently to distribute evenly. Layer half of the potato mixture into the prepared dish, spreading it in an even layer. Pour half of the béchamel sauce from Step 2 over the potatoes, then repeat with the remaining potato mixture and sauce. Dot the top with the remaining 5 tablespoons of butter, cutting it into small pats and distributing them evenly—this creates a golden, flavorful crust as it melts during baking.
Cover the casserole tightly with aluminum foil and place it in the preheated 375°F oven. Bake for 60 minutes—the foil traps steam and helps cook the potatoes through while keeping the sauce creamy. The potatoes are done when they're fork-tender and a knife slides through easily without resistance.
Carefully remove the foil from the casserole and return it to the oven, uncovered. Bake for an additional 20 minutes until the top turns golden brown and the edges are bubbling—this final uncovered baking allows the butter on top to brown and creates that desirable crispy, golden top layer. Let the casserole rest for 5 minutes before serving so the sauce sets slightly and is less likely to run on the plate.