Is gravity Maxwell's demon in disguise? 
Maxwell's demon is a thought experiment in which physicist James Clerk Maxwell suggested how the Second Law of Thermodynamics might hypothetically be violated. Basically, a demon controls a small door between two chambers of gas. As individual gas molecules approach the door, the demon quickly opens and shuts the door so that fast molecules pass into the other chamber, while slow molecules remain in the first chamber. Because faster molecules are hotter, the demon's behavior causes one chamber to warm up as the other cools, thus decreasing entropy and violating the Second Law of Thermodynamics.


So what if you flip the image above 90% clockwise and assume the existence of gravity in the direction of that yellow arrow?
Inside a vertical cylinder full of gas, the pressure should be lower at greater heights (e.g., greater distance from the gravity exerting center) --akin to the atmosphere above our heads-- considering that the pressure p exerted by a column of fluid of height h and density ρ is given by the hydrostatic pressure equation p = ρgh, where g is the gravitational acceleration.
In our flipped image, A is the top half of the column, and B the bottom half. The column height above molecules in A is then of course less than that of molecules in B. Finally, due to the ideal gas law a difference in pressure between A and B corresponds to an equivalent difference in temperature between A and B.
Unless gravity indeed manifests itself as Maxwell's demon, thereby violating the 2nd law of thermodynamics; I must have missed something. What is that something?
 A: 
Finally, due to the ideal gas law a difference in pressure between A and B corresponds to an equivalent difference in temperature between A and B.

This is the central flaw in your argument. The ideal gas law says no such thing. All that the ideal gas laws says is $p=R^\ast \rho T$, where $p$ is pressure, $\rho$ is density, $T$ is temperature, and $R^\ast$ is a constant, the universal gas constant divided by the molar mass of the gas (or equivalently, the Boltzmann constant divided by the mass of one molecule or  one atom of the gas).


I must have missed something. What is that something?

Lapse rate and atmospheric stability/instability.
The atmospheric lapse rate is the rate at which temperature decreases with altitude. Suppose an isolated packet of air starts rising for some reason. This will cool adiabatically as it rises due to the decrease in pressure. The rate at which this packet cools adiabatically with respect to altitude results in an adiabatic lapse rate. If the atmospheric lapse rate is greater than this adiabatic lapse rate, those rising packets will continue rising due to buoyancy. An atmosphere with a super-adiabatic lapse rate is an unstable atmosphere.
On the other hand, if the atmospheric lapse rate is less than the adiabatic lapse rate, those rising packets of air will fall back to where they started, and similarly, falling packets of air will rise back to where they started. Alternatively, packets of air don't rise or fall if the atmospheric lapse rate is less than the adiabatic lapse rate. An atmosphere with a sub-adiabatic lapse rate is stable against convection.
In the scenario described in the question, the Earth's non-ideal atmosphere is replaced with an ideal gas in a (presumably insulated) container. Suppose the initial lapse rate in that container is super-adiabatic. In that case, convection will quickly bring the gas in the container to a state with the lapse rate is adiabatic.
Diffusion is the only process by which temperature can change over time when the lapse rate is adiabatic or less. Diffusion is not a nearly as significant as are convection and turbulence in the Earth's lower atmosphere. (Diffusion does dominate over turbulence in the Earth's atmosphere above about 100 km altitude. This is the turbopause.)
In an isolated cylinder containing an ideal gas, diffusion will quickly become the only game in town, and it will eventually bring entire cylinder to an isothermal state.
A: Obviously, within the confines of the physical  setup that you propose, a gradual stratification of layers would occur, (taking  for simplicity, a single species), with the probability  distribution function applied at appropriate intervals giving an overall vertical velocity profile.
But this would still produce a result completely independent of the hypothetical  Daemon effect, with mixing between the layers only dependent on the function described  below.
The Maxwell–Boltzmann distribution is the function:
$${\displaystyle f(v)={\sqrt {\left({\frac {m}{2\pi kT}}\right)^{3}}}\,4\pi v^{2}e^{-{\frac {mv^{2}}{2kT}}},}$$
where ${\displaystyle m}$ is the particle mass and ${\displaystyle kT}$ is the product of Boltzmann's constant and thermodynamic temperature.
This probability density function gives the probability, per unit speed, of finding the particle with a speed near ${\displaystyle v}$. 

Image Source: Maxwell Boltzmann Probability Distribution Function
The speed probability density functions of the speeds of a few noble gases at a temperature of 298.15 K (25 °C). The y-axis is in s/m so that the area under any section of the curve (which represents the probability of the speed being in that range) is dimensionless.
So, although gravity would mimic, to within the limits of the PDF above, the effects of the Daemon, it could not replace or substitute for it.
A: There is no reason why the temperature should become higher in B than in A upon flipping because there is no selection for higher velocity molecules by gravity. Thus in A and B all molecules have the same mean kinetic energy. The gravitational field increases the density and thus pressure of the gas in B as compared to A due to the gravitational potential energy $U=mgh$ of the molecules according to $$\rho∝p∝\exp{{\frac{-U}{kT}}}$$ which gives for a small h just the linear hydrostatic pressure dependence $p=\rho g h$.
