Are police allowed to do things they would not have normally been able to do if not for the situation (e.g. tackling the attempter to prevent him from falling)?
Yes.
If so, how are they allowed to prevent a legal action?
While this is a matter of state law, generally speaking, the authority is provided either by statute or by common law case precedents in each state. Sometimes this authority is provided in the general provisions of the criminal code, sometimes this authority is provided in a criminal procedure or law enforcement professional code, and sometimes this is provided in provisions pertaining to mental health proceedings.
For example, in Colorado, Section 18-1-703(1)(d) of the Colorado Revised Statutes states:
(1) The use of physical force upon another person that would otherwise constitute an offense is justifiable and not criminal under any of the following circumstances:
(d) A person acting under a reasonable belief that another person is about to commit suicide or to inflict serious bodily injury upon himself may use reasonable and appropriate physical force upon that person to the extent that it is reasonably necessary to thwart the result.
Law buried away elsewhere clarifies that this immunity from criminal liability also provides immunity from civil liability.
Also, the fact that suicide is not a crime, and the fact that someone can be punished punitively for attempting suicide, does not mean that attempting suicide is without legal consequences.
In general, every state authorizes a 72 hour involuntary mental health commitment, on the say so of any of a long list of mental health officials without a prior court order, and authorizes further involuntary commitment with a court order, if someone is a danger to themselves or others. Not all things that are illegal or legally regulated are crimes.
For example, Section 27-65-105(1)(a)(I), Colorado Revised Statutes states in the pertinent part that:
When any person appears to have a mental health disorder and, as a result of such mental health disorder, appears to be an imminent danger to others or to himself or herself or appears to be gravely disabled, then an intervening professional, as specified in subsection (1)(a)(II) of this section, upon probable cause and with such assistance as may be required, may take the person into custody, or cause the person to be taken into custody, and placed in a facility designated or approved by the executive director for a seventy-two-hour treatment and evaluation. If such a facility is not available, the person may be taken to an emergency medical services facility.
Police officers are among the persons identified as intervening professionals under this statute.