Sure, all the water in the ocean is affected by gravity.

However, there are many different types of waves in physics, usually described by some form of wave equation[1]. And for some of those, body forces[2] like gravity doesn't play a direct role.

A relevant example is acoustic waves[3], which are the propagation of changes in pressure. In that case, the only thing gravity is doing is confining the water to a single body through which the acoustic wave can propagate, it doesn't affect the propagation otherwise as such.

[1]: https://en.wikipedia.org/wiki/Wave_equation

[2]: https://en.wikipedia.org/wiki/Body_force

[3]: https://en.wikipedia.org/wiki/Acoustic_wave_equation