transistor as an amplifier
The phase difference of 180 is observed in case of CE configuration of transistor.
When input voltage is increased, then, Ib is increased and Ic is also increased. Since Rc is between Vcc and Collector, the voltage drop across Rc is increased. Thus, collector-to-ground voltage is decreased. In a similar fashion, when input voltage is decreased, collector-to-ground voltage is increased.
As the relation between input voltage and output voltage is inverse we get a phase difference of 180 in case of CE configuration of tansistor.