The online AHD has a rather lengthy entry for take. Down in the Idiom section is:
take the cake
1. To be the most outrageous or disappointing.
2. To win the prize; be outstanding.
Unfortunately, it does not give an etymology.
However, the Online Etymology Dictionary has the following:
cake - c.1200, from O.N. kaka "cake," from PIE base *gag-, *gog- "something round, lump of something." Orig. (until 15c.) a flat, round loaf of bread. Replaced its O.E. cognate coecel. Cakewalk is 1863, Amer.Eng., probably from the cake given as a prize for the fanciest steps in a procession (hence the phrase to take the cake, 1847). Its figurative meaning of "something easy" is recorder before the literal one (1879).
However, notice that to take the cake has an earlier origin than Cakewalk.
The Origin of Englilsh Sayings page lists take the cake as:
Cake: When someone takes the cake they are regarded as having come first in some, often trivial, activity or other. Most authorities consider that this saying goes back to the days of slavery in the USA. The slaves used to hold competitions to see which couple could produce the most elegant walk. The best promenaders won a prize, almost always a cake. The extravagant walk required for this type of competition came to be called a Cakewalk and this gave rise to the old fashioned expression "it’s a cakewalk". However the meaning later came to emphasise the trivial nature of the competition and began to imply that the effort needed was minor and of little account. In consequence the modern saying "it’s a piece of cake" could well be based on these old customs.
There is a much older possible origin, going back to the ancient Greeks. A "cake" in those times was a toasted cereal bound together with honey. It was given to the most vigilant man on night watch. Aristotle is quoted as having written in "The Knights": "if you surpass him in impudence, then we take the cake".