It is never permissible to directly cause the death of another human being without just cause. In the first scenario, to manipulate the trolley in either way would be impermissible because it would be a direct action which causes the death of another human being without just cause.
By not pulling the lever, you have not murdered the 4 people, the man who tied them to the track is solely responsible for their deaths. By pulling the lever, you have now cooperated in the killing of one man, and therefore have become complicit in a murder, whereas by refusing to engage in the act, you remained blameless.
There is a Star Wars book where a character is faced with a similar dilemna. To cut a long story short, he is told that if he does not commit a murder, an evil alien race will destroy an entire planet. He refuses, using this argument (paraphrased)
“If I were to acquiesce to this single murder, then I will have given you the ability to control my actions forever. What if, after I have committed this murder, you decide to ask me to commit another, and then another? What if I am asked to destroy one planet to save two? To destroy half the galaxy to save the other half? At what point can I refuse? If I accept this one murder, then it will never end. I cannot take responsibility for your actions. Only mine.”
The only way to win is to refuse to play.