Preheat the oven to 375°F (190°C). Lightly grease a 9x13-inch baking dish.
Peel the potatoes if desired, then cut them into thin, even slices. Thinly slice the onion as well.
Arrange one-third of the sliced potatoes evenly across the bottom of the prepared baking dish.
Scatter one-third of the sliced onion over the potatoes. Sprinkle 3 tablespoons of flour evenly over the layer, then dot the surface with 2 tablespoons of cubed butter. Season lightly with salt and black pepper.
Repeat the layering process two more times using the remaining potatoes, onions, flour, butter, salt, and pepper.
Warm the whole milk in a saucepan over medium-low heat. Do not let it boil.
Carefully pour the warm milk over the layered potatoes until the liquid reaches approximately the level of the top potato layer.
Place the baking dish on a rimmed baking sheet to catch any sauce that may bubble over during baking.
Bake the Scalloped Potatoes for 45 to 60 minutes, or until the potatoes are fork-tender, the sauce is bubbling, and the top develops an appetizing golden-brown finish.
Remove the baking dish from the oven and allow it to rest for about 10 minutes before serving. This short resting period helps the creamy sauce settle and thicken around the potatoes.