The Twelve Infallible Imams from Ahlul Bayt (AS) did inherit the knowledge of the Prophet Muhammad (SAWA). That is why, their status is from his status as Allah says in Quran ذُرِّيّةً بَعْضُها مِن بَعض A Progeny (of the Prophet) which part from him. Their status is higher than everyone except the Prophet Muhammad (SAWA) who is The Highest over all creatures.
Wassalam.