1.Place a command block and set this command
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {EntityId:Zombie,SpawnData:{Attributes:[{Name:generic.movementSpeed,Base:0.001},{Name:generic.knockbackResistance,Base:1.0},{Name:generic.maxHealth,Base:400.0},{Name:generic.followRange,Base:20}]}}
2.activate the command block
3. hit the zombie with diamond sword
4. notice that it needs 3-5 hit to kill it even I set maxHealth to 400
5.Place a command block and set this command (It has same NBT tag as previous Zombie)
/summon ~ ~1 ~ Zombie {Attributes:[{Name:generic.movementSpeed,Base:0.001},{Name:generic.knockbackResistance,Base:1.0},{Name:generic.maxHealth,Base:400.0},{Name:generic.followRange,Base:20}]}
6.activate the command block
7. hit the zombie with diamond sword
8.notice that it doesn't die in 3-4 hits
i think that mob that spawn by monster spawner doesn't have its health set to max health
but the summon command set mob's health to max
sorry for my english but i think it is hard to explain
Malformed command, you didn't specify HealF
Example: