Alexei,
Great question, a few days ago something was telling me that somebody would raise the question about the Pigs and the Legion of demons. Great question.
If you've read the story of the event ... You will know that the Story combines Exorcism with 'nature' ... the Swine.
Characteristic of a Demon: Unclean Spirit
Characteristic of a Pig: Unclean Animal
Also ... The Demons are the one who said to Jesus not to torment them and begged him to Let them go into the Swine. To this you'll probably say .... "oh but why did Jesus did this, what had the farmer to do with this" ... Good question...
Golden Rule: Pigs are forbidden to be raised by a Jew, they are an Unclean Animal just as i told you above. So for one ... They are forbidden to be raised.
Here again the dwelling in the tombs pictures a fondness for unclean ways in which is nothing of heavenly life. The fierce and unclean spirits prayed that they might go into the swine, because they were themselves swinish in nature; and the Lord suffered them to go, because they thus showed their true character, which every evil must do before it can be condemned and removed. The miracle was done to teach us of the Lord's power to cast out from us swinish affections which no man can bind or tame, that we too may sit at His feet, clothed and in our right mind. Do we gratefully accept the Lord's deliverance? or are we troubled at the loss of the swine, and do we beseech the Lord to depart? from http://www.swedenborgdigitallibrary.org/LP/lp15.htm
The Farmer who raised those Pigs was JEWISH, he should NOT have been breeding pigs, in the Old Testament, in the book of Leviticus its VERY explicit abou the nature of Pigs and WHY are forbidden.
Anyway ... In my personal opinion...I dont personally think Jesus is that cruel to have caused personal loss to the man, i assume god would have made it upto him somehow. But like i said, he should have not been breaking the law by raising pigs in the first place. Because if he did not disobey the law, he would have not raised pigs, and they wouldn't have been a loss to him.
When you do your own will and go against God, dont blame him for your problems. Like i said, God would have made it upto him in my opinion.
Thanks for your questions