In meantone, all but one of the fifths are flattened from the pure 3:2 ratio by 1/4 of the syntonic comma. The remaining fifth ends up being sharp by 1 3/4 of the syntonic comma (the wolf). The syntonic comma is the ratio 9/8 divided by 10/9, which is the ratio between a pure C-D interval and a pure D-E interval. (In a pure harmonic series starting at CCC (bottom C on a 16' voice), middle C is 8 times the fundamental, middle D is 9 times the fundamental, and middle E is 10 times the fundamental.)
What Paul has described is only one variety of a number of mean-tone tunings.
A mean-tone tuning is any modification of just tuning (in which all pitches in a scale are derived directly from the overtone series, and therefore form pure, beatless intervals with the tonic pitch) in which the two whole-steps which add together to make a major 3rd are the same size.
This may seem rather obscure at first, but it is actually fairly simple. As Paul observed, in just intonation (for example, starting from C), the whole-step C-D is formed by a ratio of 8:9 (this one is called a major whole-step), and the one from D-E by a ratio of 9:10 (called a minor whole-step). Thus, the D is closer to the E than to the C; likewise the G in the 3rd F-G-A is closer to the A, etc.
In a mean-tone temperament, the fifths are distorted by a certain fraction of the syntonic comma, which Paul described. The result is that in a major 3rd the middle tone is equidistant from the two outer pitches: i.e., it is the "mean" (meaning middle) between those two notes.
The mean-tone temperament which Paul describes, by 1/4 comma, was first written-up just after 1500 by Pietro Aron, and is the best known. The result of this procedure is a scale with 8 pure major 3rds and 4 diminished 4ths. But there were other mean-tone procedures known in the 16th and 17th centuries, especially by 2/7th comma (in which, I believe, the *minor* 3rds are pure and the major 3rds beat), and 1/3rd comma. In the the mid-18th century, several instrument-makers and theoreticians used a 1/6th comma mean-tone temperament, particularly Gottfried Silbermann and Vallotti (and Thomas Young?). For that matter, equal temperament is mean-tone by 1/12th comma. So, all the Steinways and Bösendorfers you have ever heard are in mean-tone temperament.
With regard to meantone in J. S. Bach's time:
As I understand the matter (and there may be gaps in my understanding), Bach lived and worked in a time of transition with regard to tuning and temperament. So I would expect that he had to work with a number of tuning-systems through the course of his career.
(Before I go any farther, I must lay one bit of ground-work. All the systems of tuning and tempering used in European music are derived from the Pythagorean tuning. In that system, all the 5ths are tuned pure and beatless. However, the "circle of 5ths" is incomplete, because of the mathematical impossibility of deriving an octave from a series of pure 5ths. Thus, when you start on C and tune pure 5ths, you end up with a B# that is substantially different from the original C. The difference between the C and B# is called the syntonic comma. All the different mean-tone and well-tempered temperaments -- and "equal" temperament is a mean-tone -- are derived by adjusting some or all of the 5ths in a Pythagorean progression; this adjustment is called "tempering" the intervals.)
When he was young, most organs in Germany were tuned in something like 1/4-comma meantone. I say "something like" because it was very common to modify the theoretical scheme in order to expand the tonal possibilities.
To be more specific: a text-book 1/4-comma meantone has for the five black notes C#, E-flat, F#, G#, and B-flat -- but because they are all part of pure major 3rds, they cannot be used as their enharmonic equivalents. Thus, there is no 3rd D-flat-F (but instead a diminished 4th C#-F), nor B-D# (but instead a diminished 4th B-E flat), etc; and there is no 5th A flat-E flat, but instead a diminished 6th G#-E flat. One could tune the note between G and A as a A-flat, of course, but then one lost the G# -- likewise the E-flat could be tuned to D#.
On some organs, built for situations in which money was no problem, those black notes were split (into front and back halves) so that the player could have both G# and A-flat, D# and E-flat. Another solution, commonly practiced, was to tune the note between D and E to a pitch half-way between -- giving a semitone that is usable as both E-flat and D#, but that is not in good tune for either. And likewise A-flat/G#. In Bach's first decades, this is likely what he played on. And throughout his life this is the sort of tuning that would have been found on the organs of churches in small towns and villages.
In the major cities and musically-progressive courts, like Leipzig and Weissenfels (and maybe Saxe-Weimar?), organists and organ-builders were tuning their instruments in a way that allowed one to play all the way around the circle of 5ths. (In 1/4-comma meantone, remember, there is no circle of 5ths, because it is broken by the "wolf" at G#-E flat.) We call a tuning with a complete circle of 5ths "circular" or "circulating."
Gottfried Silbermann used a milder sort of meantone, in which the 5ths are tempered by 1/6 comma, which is circular. We know, however, that Bach did not care for it, because any time he was making a public examination of Silbermann's instruments, he would draw all the stops and play in the single worst key in th scheme (A-flat major).
The other possibility was some kind of "well-tempered" tuning, such as were being promoted by Andreas Werckmeister. These were circulating temperaments (one could go all the way around the circle of 5ths), but they were irregular, as opposed to the mean-tone temperaments, which are regular -- meaning this: in any of the mean-tone tunings, theoretically one starts on a given pitch -- E-flat in the case of the most common 1/4-comma procedure -- and tunes from there all fifths reduced by 1/4 of the syntonic comma: E flat - B flat - F - C - G - D - A - E - B - F# - C# - G#.
If they are all diminished by 1/4 of the comma, the result is pure major 3rds. Other reductions by different fractions of the comma give different results; but they are all "regular" in that all of the 5ths are treated in the same manner.
An irregular temperament treats some 5ths in one way, others in a different way. For example, in what is known as Kirnberger III, the four 5ths C-G-D-A-E are diminished by 1/4 comma, just like the 1/4-comma meantone; but the other fifths are all pure: F - B flat - E flat - A flat - D flat, and E - B - F#. The theoretical basis for these "well-tempered" tunings is thereby not an evolution from mean-tone tempering, but a different way of modifying the Pythagorean tuning.
All the various well-tempered tunings belong to this "irregular" class, including the Werckmeister and Kirnberger temperemants, and Thomas Young, Vallotti, Rameau, Kellner, and the French "temperement ordinaire." Although we do not know precisely which one Bach favored, this is the kind of temperament that he had in mind for "Das Wohltemperierte Klavier." One must keep in mind, however, that this work dates from the middle of Bach's career, the year before he moved to Leipzig. 20 years earlier, he would have been working in a predominantly mean-tone environment.
This may explain why there are two versions of the Toccata BWV 566, one in C and one in E. According to Harald Vogel, Bach, his cousin J. G. Walther, and other organists connected to them customarily altered the keys of pieces originally composed for a mean-tone organ in order to adapt them for performance on well-tempered organs. In the case of BWV 566, the C version would be for the mean-tone instrument, the E version the adaptation for well-tempered tuning. The E-major Praeludium of Vincent Lubeck (as we know it now) may have been subjected to this same process: it could not have been played on any organ that Lubeck worked with -- they were all mean-tone -- and it survives to our time (like most all of the Praeludia of Buxtehude, Bruhns, and all the late North German school) in copies transmitted through Bach and his buddies.
As I write, I am considering the various Preludes and Fugues of Bach and their tonal ranges in relationship to the history of his career. The earliest -- pieces in C major and minor, D major, E minor, G major and minor, A minor -- all fit fairly well into a modified mean-tone scheme. It could not have been a pure 1/4-comma mean-tone, because of the A-flats in the C-minor pieces and the G#'s in A minor. I must suppose that the G#/A-flat was adjusted so that the one pitch could be used in both functions. At the other end of the tonal spectrum, the E-flat Prelude and Fugue could only have come at the end of Bach's professional life and not at the beginning (and indeed, E-flat major is a very unusual key before 1720 or so).
To sum it all up: there is no one style of tuning that is appropriate for all of Bach's keyboard music.