Precise definition of farming is kindah vague, but the one form of cheating is where your coordinating with your enemy to generate sp. leaving someone alive so they can be trampled by your enemies is called your allying that player, unless you like them. This one of the reason communication between allies is important.
Also tactically deciding that player rank 1 will be easier to kill over a skilled player, even if he gets a large empire ie allowed and is reasonable.
The type of farming where you are using your enemies but your enemy isn't aware you are using him to farm gets tricky as to where it is legal. Amok/Ivan have official ruling on this one, but i would say it technically isn't illegal. Reasons being that if your forces are nearly matched, even if the opponent aren't skilled, it will be a good learning experience for other players and therefore should be allowed. If there is a ridiculous difference in troops and land, that there is no chance of winning for the less skilled player you are simply torturing the newbie, which will most likely cause the newbie to quit and not come back therefore it is not allowed.