‘Hard done by’ is a common and well-understood phrase in the UK, Canada, and most other commonwealth countries.
The usage with the doubled ‘by’ sounds (to my ear) a little ungainly, but not incorrect; and it’s used a reasonable amount in the wild, including (though not only) by professional writers and highly-educated speakers:
Doubtless those on the far reaches of the left are feeling hard done by by the president-elect's cabinet appointments thus far. —Jonathan Leffler, in the Guardian
I wouldn't be surprised if Australia becomes a republic but that is because of a number of factors, including the fact that they feel hard done by by the old country. —Sir Robert Worcester, quoted on the BBC website
Grammatically, the parsing is that hard done by is a participial phrase, and hence can take a further by to attribute agency. It comes from a phrasal verb to do hard by (someone), which is no longer idiomatic in itself, but is closely analogous to still-viable phrasal verbs to do well by, or to do right by (meaning: to act well towards someone). For instance:
I trust Jane: she did right by my friends.
We can certainly turn this round into an agentless passive, with no problems:
My friends were done right by.
The trouble comes when we try to attribute agency in this example:
? My friends were done right by by Jane.
This usage seems very rare — google finds only a handful of examples. However, this shows how the grammatical form makes sense; and in the case of ‘hard done by by’, it’s clear that many more people are happy to use the form with the doubled by. I suspect this difference is because “X was done right by by Y” can easily be turned around into the less awkward “Y did right by X”, while in the case of “X was hard done by by Y”, there’s no such obvious alternative, since the form “*Y did hard by X” (or “*Y hard did by X”??) have been lost.