There are several versions of the history of that phrase, but the most likely one is that it was coined by Heinrich Beta in 1845. He was publicist, especially for national economy topics, and he wrote on religious faith, saying that blessing can not be achieved through faith and through the old clerical/feudal order but through work. It was then picked up by Lorenz Diefenbach who wrote a novel on two criminals who find their way to a good fate through hard labour. That was in 1873, and from there on we simply don't know the route that phrase took to the Nazis in the 30s. We don't even know exactly who put it up on the gates of the camps, but it's very likely that it was Theodor Eicke, the first SS commander of KZ Dachau. Another theory says that it was invented by Rudolf Höß, the commander of Auschwitz, because the phrase was used in every single camp he had worked at before Auschwitz. The problem is that Höß talked about that phrase extensively in his memoir fragments and reports but never claimed it to be his idea, although he said that it made sense - every prisoner he talked to said that camp life would be even more unbearable without work, according to Höß.
The phrase seems cynical to us, and rightly so. Especially regarding the death camps, it was a simple lie. Those who walked under that gate were planned to never be free again. There's also a destinct anti-semitic element in using that phrase, the one saying that Jews wouldn't do hard labour but only work with money and power.
One last anecdote: The iron sign in Auschwitz was made by inmates. One of those was Jan Liwacz, an artisan smith who survived more than four years in Auschwitz and was liberated in Mauthausen in 1945. In a small act of protest, he put the "B" in upside down: http://imgur.com/VmdpNq6