Clayton Cramer explains:
In my book Black Demographic Data, 1790-1860, I devote a chapter to discussing how the 1840 census data was used to prove that free blacks were more likely to be "insane or idiot" or disabled the further north you went in the U.S.--and partisans of slavery used the data to prove that freedom was bad for slaves, based on this data.
While it does appear that there was actually an increase in physically disabled free blacks just north of the border, it was not because freedom was bad for blacks. It appears that the reason was that slave owners would dump disabled slaves across the border as a way of getting rid of slaves that they would otherwise have to support. (They could not free a slave in their home state without legislative permission, and this would not be granted if the goal was to dump a disabled slave onto the county poorhouse.)
All sorts of dark conspiracies were imagined for a very long time to explain how the 1840 census data ended up with these astonishing numbers--but Patricia Cline Cohen's A Calculating People: The Spread of Numeracy in Early America contains what I consider by far the most satisfying explanation--miscoding errors. The column for "idiot and insane" whites was right next to the "idiot and insane" column for blacks--and these columns were very, very long. It was therefore very easy for census marshals to accidentally enter the "idiot and insane white" count in the "idiot and insane Negro" column. Especially the further north you went, the fewer blacks there were in the population--so even moving one or two mentally disabled whites into the back column would have very disproportionate influence: the mentally ill and retarded whites who might be 1% of the white population in a small town magically became 10% of the black population.