If someone tampers with the ball, they will banned for 2 matches because they have changed the natural condition of the ball. Why is rubbing the ball allowed as that also changes the "natural condition" of the ball?
This is covered under Law 42, section 3 - https://www.lords.org/mcc/laws-of-cricket/laws/law-42-fair-and-unfair-play/
(a) Any fielder may
(i) polish the ball provided that no artificial substance is used and that such polishing wastes no time.
(ii) remove mud from the ball under the supervision of the umpire.
(iii) dry a wet ball on a piece of cloth.
(b) It is unfair for anyone to rub the ball on the ground for any reason, to interfere with any of the seams or the surface of the ball, to use any implement, or to take any other action whatsoever which is likely to alter the condition of the ball, except as permitted in (a) above.
So polishing the ball on clothing, or using sweat, is perfectly ok. Other types of tampering are not permitted.