In the Mishna to Chullin 4:6 (s.v. וכן שניטל צומת הגידין), the Bartenura refers to the Rif as having been the Rambam's teacher: "ושיטה זו תפסו רבותי... אבל רמבם ורב אלפס רבו תפסו עיקר הפירוש אחר". In actual fact, the Rif died in 1103 and the Rambam was not born until 1138. While it is possible that the Rambam had studied for a brief time under the Rif's student, the Ri Migash (1077-1141), it is most likely that he received his primary education from his father, Maimon, who was himself a student of the Ri Migash and not of the Rif.
To say that the Rambam's teacher was the Rif because his actual teacher had studied under a student of the Rif seems like a rather long shot, and I feel forced to conclude that the Bartenura meant one of two things: either the Rambam studied the Torah of the Rif (in which case the Rif was his rav in the same way that R' Yosef Rosen, for example, described the Rambam as his rav), or the Bartenura actually thought that the Rif had literally been the Rambam's teacher.
Neither of these suggestions is entirely satisfactory to me: the first seems fanciful and the second is predicated on something that we know to be simply wrong.
a) Is there another way in which the Bartenura's statement might be understood?
b) Alternatively, is there precedent for describing as one's rav a person who died before one was born?
c) Is there reason to suppose that at the time of the Bartenura people may have thought that the Rambam had studied under the Rif?