Read a news report about an imam and you are almost certainly reading about a mosque employee. Read a Shia theological text about the Imam and you are reading about something no employer could appoint.
In Sunni usage the word means the person leading the prayer. It is functional and it is temporary: whoever leads is the imam for that prayer. The hadith on precedence say the one who leads should be the best reciter of the Qur'an, which is a qualification anybody can acquire and nobody can confer. A mosque hires a full-time imam to lead prayers, preach on Friday and answer questions, and that is a contract of employment. The mosque committee can end it. Nothing sacramental is removed when they do, because nothing was added when they hired him.
In Twelver Shia usage the Imam is one of twelve divinely designated successors to the Prophet, from the line of Ali and Fatima, held to be free from sin and error and to be the authoritative interpreter of revelation. The twelfth entered occultation in 874 and is awaited. This is not a job. It is a claim about the structure of religious authority in the world, and the whole edifice of Shia jurisprudence, including the position of the marja, who acts in the Imam's absence, is built on it. Ismailis follow a different line, and the Nizari Imamate is held by a living person.
The offices share a word and nothing else. Describing either as the Muslim equivalent of a priest gets both of them wrong: the first because there is no priesthood to be equivalent to, the second because the claim being made is very much larger than priesthood ever was.