I wouldn’t say that it’s impossible to run wire 400 feet and have power. Run the gate off a 12-volt motor. But run 120 volts to the gate underground (in a good low loss wire) and step it down with a switch mode power supply. Switch mode power supplies are inexpensive (I would bet you have thrown a few away over the last several years, computers use them), and very tolerant of input voltage variances. They will work with much lower or higher voltages then just 120-volts.
A 50 watt solar panel will cost $300.00 or $4.00.00 or more. A good charge controller cost at least $100.00, a battery cost $50.00 or more.
A 50-watt switch mode power supply can be had for free. But you need 400-feet of wire to power it.
_________________________
You can run, but you'll only die tired.