The 'as a ranged weapon' is in its own, single sentence paragraph that only applies to provoking AOO when attacking(Until you pick up Whip Mastery. Its an exception to the paragraph above it where it defines the whip as a melee reach weapon with 15' reach.
Here's the summary of whip: One-handed exotic Melee weapon, with disarm, nonlethal, reach and trip. Exceptions given in the weapon desc are as follows: No damage to targets with an armor bonus of +1 or a NA bonus of +3 (or greater). 15 foot reach that does *not* threaten, and can attack adjacent targets. Its provokes AoO when attacking, as per ranged weapons. It is finessable even though it is not a light weapon.
Whip Mastery: Removes provoking AOO, allows lethal damage, cancels the no damage to armored targets.
Improved Whip Mastery: Threaten your natural reach +5' with the whip. Also grab objects with the whip, and use it as a grapple hook.
Greater Whip Mastery: Never drop the whip on failed disarm or trip. Grapple targets with the whip