The problem is twofold... 1. It's obvious that you haven't replaced the joker valve in quite a while (it should be replaced at least annually)...and 2. The inlet and vent fittings in your tank are in the wrong place (very common problem).
So...replace the joker valve ...But that's only a band aid. Turning the y-valve to overboard will block the backflow, but that's only a band aid too. If you're gonna do it right, you're also gonna have put a loop in the toilet hose unless you want to relocate the inlet fitting on the tank...which MIGHT actually be easier, 'cuz thanks to a li'l doodad called the Uniseal, it's not that hard to do.
It doesn't have to be a vented loop, just an arch in the hose that's high enough to prevent waste in the tank from getting over the top of it at maximum heel.
You'll also want to be religious about keeping your tank vent line open...'cuz if waste is spilling back into the head discharge line, it's most likely spilling into the vent line too...and that'll block it up in a heartbeat. So you'll want to backflush it EVERY time you pump out and/or wash to the boat
...or move it too.
As for why joker valves should be replaced at least annually...
Blocking backflow is only a secondary function of a joker valve...it's the most important rubber part in the pump!
On the upstroke of the piston, a vacuum is created in the area beneath the piston. This causes the joker valve to close tightly, and the flapper valve beneath the pump to open, allowing some of the contents of the toilet bowl to be drawn into the bottom half of the pump. Then, on the down stroke of the piston, the flapper valve is slammed shut, and the effluent is forced out of the bottom of the pump, through the joker valve, and off down the line.
When the joker valve cant seal tightly on the upstroke of the piston, no vacuum is generated when you pump it. So the more worn the joker valve gets, the less efficient the toilet becomes at moving waste out of the bowl and down the head discharge line.