According to 1 Chronicles (1 Chronicles 6:16, 1 Chronicles 6:22–28), Elkanah and Samuel were from the tribe of Levi. With no territory of their own, the Levites lived amongst the other tribes (see Joshua 21:1–45). Those descended from Levi’s son, Kohath, were allocated cities in the tribal territory of Ephraim (Joshua 21:20–26). Thus when it is said that Elkanah was an Ephraimite, this refers to the territory where he lived and not to his tribal descent.1
1 There was a certain man of Ramathaim-zophim of the hill country of Ephraim whose name was Elkanah the son of Jeroham, son of Elihu, son of Tohu, son of Zuph, an Ephrathite.