3 pounds potatoes, thinly sliced
½ onion, thinly sliced
9 tablespoons all-purpose flour, divided
6 tablespoons butter, diced and divided
salt and ground black pepper to taste
3 cups whole milk, or as needed
Preheat oven to 375 degrees F (190 degrees C). Grease a 9x13-inch baking dish.
Spread about 1/3 of the potato slices into the bottom of the prepared baking dish. Top with about 1/3 of the onion slices. Sprinkle 3 tablespoons flour over the potato and onion. Arrange 2 tablespoons butter atop the flour. Season the entire layer with salt and pepper. Repeat layering twice more.