Not all socialist governments were the result of a coup, some were voted in. However, it appears that once a socialist takes power, it generally turns into a dictatorship or authoritarian, and is only removed by force.
Look at Venezuela, The Congo, Ethiopia, Somalia, and Nicaragua. These were all voted in but became single-party dictatorships.