Lightly butter the sides of a 9-inch cake pan (not a springform pan).
Combine the butter, sugar, cinnamon, and nutmeg in a small saucepan and boil 30 seconds. Scrape the mixture into the prepared pan and spread evenly. Sprinkle the apples all over and press them down slightly to level them.
To make the cake, beat the butter and sugar with an electric mixer until creamy. Add the eggs and vanilla, and beat until very smooth and fluffy, about 2 minutes.
Sprinkle in the flour, cornmeal, baking powder, and salt, and beat 10 seconds. Pour in the milk and beat just until the batter is evenly moistened, about 1 minute. Spoon the batter over the apples and smooth the top.
Bake 50 minutes, or until a knife inserted in the center of the cake comes out dry. Run a knife along the outer edge of the cake to loosen it from the pan. Place a plate over the cake, then flip it over to invert the cake onto the plate. Let the cake cool completely before serving.