but when you're baking, butter triumphs over margarine every time. for cakes, cookies, and pastries, butter (unsalted, that is) provides richer flavor. (it begins as cream, after all, and margarine is made from vegetable oil.) butter's high fat content is also what gives baked goods their texture.