In my book, both are correct. They finished eating - suggests that the process of eating cakes had ended. They finished to eat - suggests that they finished doing something in order to start eating cakes At least that's my interpretation.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.