Why doesn't a Brownian ratchet provide free energy? A Brownian ratchet is described here at Wikipedia.
The "why it fails" section reads:

Feynman demonstrated that if the entire device is at the same temperature, the ratchet will not rotate continuously in one direction but will move randomly back and forth, and therefore will not produce any useful work.
The reason is that the pawl, since it is at the same temperature as the paddle, will also undergo Brownian motion, "bouncing" up and down. It therefore will intermittently fail by allowing a ratchet tooth to slip backward under the pawl while it is up.
Another issue is that when the pawl rests on the sloping face of the tooth, the spring which returns the pawl exerts a sideways force on the tooth which tends to rotate the ratchet in a backwards direction.

These reasons sounds strange as physical argument to me:
-The pawl also undergos Brownian motion is a trivial fact, but I don't see any reason why it is relevant. This sound more of a practical problem rather than a theoretical one. Moreover, the forces exerted on the pawl and the paddle are applied at different direction - one radially (with a spring counteracting against it), one tangentially. How can they be compared directly?
-The sideway force would restores the energy back to the gas in the paddle, leaving the total energy unchanged. and it doesn't matter in a statistical sense anyway even if this force is comparable to, or bigger than the Brownion motion of the gas - most likely the expectation just becomes a shifted Gaussian distribution.
So, why doesn't this setup violate the second law of thermodynamics?
 A: Perfectly Elastic Ratchets Fail
When the pawl of a ratchet passes over the tip of a tooth and falls to the next one it must dissipate energy in order to be effective. If it collided perfectly elastically with the next tooth, then it would just bounce right back up to its original height allowing the previous tooth to go backwards. In order for the bouncing to reduce to a height that the ratchet would work, energy must be dissipated in the form of heat. This of course means that for every tooth the pawl passes over it must require this energy before it can be dissipated. The magnitude of this energy can be approximated as:
$$\frac12\,k\,h^2$$
Where $k$ is the effective spring stiffness at the pawl, and $h$ is the height that the pawl drops between teeth.
Functioning ratchets must resist being rotated in either direction.
This energy comes from the next tooth pushing the pawl upwards as it rotates. The contact angle between the pawl and the tooth determines the ratio of torque to lifting force*, but whatever the ratio, the tooth must push the pawl up by a distance $h$, so the work required is $\frac12\,k\,h^2$ plus any frictional losses. This work must come from torque on the shaft integrated over the rotation.
$$\int_0^{\theta_{tooth}} \tau d\theta = \frac12\,k\,h^2$$
Our energy extraction also provides resistance
Depending on our mass and diameter etc. We'll extract some amount of energy $W$ for every tooth that the ratchet passes over.
We made a heat engine
So now it looks like we have a heat engine. We have a hot bath, that for every ratchet tooth we pass we're extracting energy from via random motion $Q_H$, and we're transfering that energy to our output $W$, and to a cold bath that contains our ratchet $Q_C$.
$$Q_H=W+Q_C$$
In order to successfully extract energy we need the random energy fluctuations on the hot side to be large enough in magnitude to actually drive the process forward, and we need the random energy fluctuations on the cold side to be low enough that the pawl isn't bouncing around doing no good. This heat engine should be limited to the carnot cycle efficiency, but it would most likely be much much much worse.
*Pawl spring force vs torque
If you plot pawl height vs angle of the gear. The slope of that line gives you the mechanical advantage of the gear vs. the pawl, and thus the ratio of torque on the gear to force on the pawl. If the slope was zero (or vertical) they would be independent. However, it's not possible to make a cyclic pattern using only horizontal and vertical sections that only ratchets in one direction 
A: Yes this setup violates the second law of thermodynamics .The law states that - "It is impossible for any device that operates on a cycle to receive heat from a single reservoir and produce a net amount of work." Now you know the answer
