Both are correct.
three four! four! possible interpretations. There isn’t really any difference in meaning between the first three, and I don’t believe the fourth is plausible, so it’s entirely up to you whether you use “is” or “are”.
- The subject is an implied noun. The noun is quantified by “four”, so it must be a plural, and “are” agrees with it: “Four [cakes] are better.”
- The subject is an implied gerund (of which “four [cakes]” is the object). This is taken as singular, and “is” agrees with it: “[Having] four is better.”
- The subject is “four”, here being used as a noun meaning “a group of four objects”. This is one group, and “is” agrees with it: “[A group of] four is better.”
The first two have been extensively covered by other answers, but I haven’t seen anyone mention the third except in comments. I’m sure there are style guides out there that insist that using a number (other than one) as a singular noun for a group is bad and shouldn’t be done. The fact is, though, it is done.
The fourth interpretation is different. The versions above all take “better” as comparing the number: “this amount is better than that amount”. But there’s another possibility…
- The comparison “better” refers to the cakes themselves. The quality of one particular cake is good, but there are four cakes that have better quality. In this case, it must be “are”, not “is”. The reason is the same as for possibility #1, above. “Four” quantifies the implied plural noun “cakes”, and “are” agrees with that.
It can’t be “one group of four” as in possibility #3, because comparing the cakes’ quality is partitive—you’re saying each cake, individually, is better than the first one. You are not treating them as a group that is better in quality only when put together.
But again, I don’t think this is plausible. The sentence is ambiguous, but my mind went only to the first interpretation (“it is better to have four cakes”), and I had to have the second (“the quality is better for four of the cakes”) pointed out to me. I know it’s presumptuous of me to think that all, or even most, English speakers would resolve the ambiguity the same way I did. But I do think that. I honestly don’t think most speakers would think you meant the second one, and I think many wouldn’t even consider it.
If you wanted to communicate the second meaning, you would need a construction like “of them”:
One cake is good, but four of them are better.
One of the cakes is good, but four of them are better.
And I still find those odd. I would expect the “good” cake to be clearly identified, not left as a puzzle!
This cake is good, but four of them are better.
The cake you picked is good, but four of the others are better.
And in this situation it must be “are”. I would read this next form as implying “having”, returning it to the first meaning:
One cake is good, but four of them is better.
[Having] one cake is good, but [having] four of them is better.