I did almost exactly what Laura did, in 2016 - same Italian restaurant, LOL! It was surprisingly affordable and decent pizza, though this was in 2016 when the dollar was stronger than it is now. But you don't have to buy ANY meals in advance if you wish not to - I didn't. I didn't even buy breakfast - I had some granola bars with me.
However, the St. Peter Line 72 hour visa-free visit to St. Petersburg has changed since Laura and I did it. The ferry line has been acquired by another company, and since then they have changed the scheduling. (Now only one ferry does the run to St. Petersburg - used to be two.) When I did it, the ferry went overnight from Helsinki and arrived in St. Petersburg in the morning - and as soon as we arrived we got off; after two nights, we got back on the ferry the third afternoon and headed back to Helsinki that night and got off the next morning. But today, as I understand it, they make you stay on board when you arrive in St. Petersburg (unless you have a Russian visa) til early afternoon, then you have three nights and return at about the same time three days later and have to wait to leave til the evening. This gives you closer to 72 hours, a little more time than we had.
Anyway...you'll have more time for breakfast than I did on the arrival in St. Petersburg, and that's a case where maybe I might enjoy a leisurely breakfast, instead of basically rushing to pack and get off in the morning as I did - not really time for breakfast!
Either way, have fun - I really enjoyed the ferry rides much more than expected. The ship may not be as luxurious as the fancy cruise ships, but it was decent enough, and I'd do it again in a heartbeat.