The vapor barrier is to prevent humidity from accumulating in the insulation, so the vapor barrier goes between the warm area and the insulation.
That's the problem with rules of thumb- it's possible to hit 'em with a hammer!
More important than keeping moisture out of the insulation (where it does no harm, if the insulation is XPS foam) is keeping humidity out of the wood, where it can create mold & rot conditions. The wet-insulation issue is secondary, and unlikely to occur from vapor permeation alone with non-hygroscopic insulations like fiberglass. Air-leaks and capillary draw are orders of magnitude larger moisture transport mechanisms than vapor diffusion. AIR BARRIERS are far more important than vapor retarders/barriers for keeping moisture out of the assembly. (A square inch of air leak is worth more than a whole wall of vapor diffusion through unpainted wallboard.)
But on a basement floor you have vapor pressure from both directions- diffusion from the warm room air into the not-so-super-permeable XPS foam insulation, but more importantly, the near-100% humidity of ground moisture coming up from the slab. Here the foam is only slightly permeable, but the higher drive will be from below (even though it's the cold side!)- the foam will stay drier with the poly between the XPS and the slab. If the poly is between the OSB and the XPS you'll end up punching more holes in the poly, since it's within reach of the nails that secure the wood flooring to the nailer-deck OSB. Since it's above the XPS it'll be warm enough that it won't condense, but the humidity level of both the OSB & flooring will be higher.
In above-grade walls, etc the rule of thumb is true- the higher vapor retardency layers in the stackup go on the side that is warmer for more hours on an annulaized basis, but in all but the very coldest (or most hot-humid) US locations, using highly retardent layers such as polyethylene or foil is a double-edged sword, since it effectively prevents the assembly from drying toward the usually-warm side, effectively cutting it's ability to dry from bulk-water incursions in half. Yes, it prevents condensation from vapor-permeation, but it doesn't let anything out either. Most of the time semi-permeable or semi-impermeable vapor retarders (not
barriers) like kraft backing, an inch or less of XPS or vapor-retardent latex will result in drier assemblies, and greater resiliency from the occasional rain-drip that finds it's way into the wall during a gale wind. (And using hygroscopic insulation to redistribute the drips that make it in results in an even more resiliant assembly, as long as it's drying capacity hasn't been crippled with vapor
barriers.)