1.As Early as the 5th century the Greeks used 'take the cake' as symbolic of prize for victory. (See: "The knights" by Aristophanes, written in 424 BC).
It was along way the expression entered into English language in 19th century in translation from ancient Greek.
Some authorities consider that this saying goes back to the days of in the slavery in the USA. It was connected with so called 'cake-walk'.
2. Resources: The internet.
Thank you for the question.