One of the most often repeated phrases about baking these days is that butter is better, or even that butter is best. It is flavorful, moreso than shortening or vegetable oil. It has the interesting property of being a solid at room temperature and a liquid when put into the oven, where the water in the butter vaporizes, creating tiny little puffs of steam that contribute to a light, tender baked good.
But butter is not necessarily the best choice for everything. When it comes to greasing pans, vegetable oil and shortening are actually better choices. They may not impart any extra butter flavor to the “crusts” of your cake, but they are both more effective at preventing cakes from sticking than butter. Remember that little bit of water I mentioned? It makes up about 20% of the total weight of butter, and any place where your pan is coated with water - as opposed to fat (the other 80%) – is fair game for cake batter to adhere to. Vegetable oil and shortening, by contrast, are 100% fat and don’t present the same potential for sticking. So, the best way to grease a pan is to use shortening or vegetable oil (either poured into the pan or sprayed) and spread it around into all the corners to ensure that every inch is covered.
Of course, if you’re very generous when you grease your pans, you shouldn’t have too much of a problem using butter. And if you’re careful to run a knife along the edges of your pan and line the bottom with parchment paper, you should be fine, too. But the idea of greasing is simply to make it easy to get the cake out, not to try and create another layer of flavor, so it seems wise to use oil in the first place and avoid the possibility of sticking all together.