Layer the bottom of casserole dish with half potato slices. Cover potatoes with layer of half of onion slices and then half of the cheese. Repeat the layering process until all of the ingredients are used up. Mix milk, flour and pepper together.
Pour milk mixture over the entire casserole. Place butter tablespoons around on top.
Cover with foil and cut slits in foil and bake until the potatoes are cooked and the cheese is bubbly; cook 45 minutes covered and then turn oven up to 425°F and bake an additional 30 minutes uncovered.