Magnetodeformation and elastic properties of ferrogels and ferroelastomers