Sometimes, an activity can have float but still be on the longest path. In almost every case, this occurs because there are multiple calendars on the longest path.
Suppose an activity on the longest path is on a 7-day calendar, and its successor is on a standard 5-day calendar (Mon-Fri). If the predecessor activity is delaying and pushes the successor to a Monday, the predecessor likely gained two days of float because it can delay on Saturday or Sunday without impacting the successor. Since it can delay without impacting its successor, it technically has float.