Can a flyback diode work on the "ground" side of a transistor?
Yes, that could work fine, provided you have accounted for the Vgs drop (threshold voltage) for the FET vs. the relay pull-in voltage. Otherwise, use low-side instead. For a small coil that’s on your board this is the easier choice.

Put the diode directly across the coil if possible to minimize the flyback current loop area, regardless of the switch method you choose.

Discussion:

NMOS on the high-side is the classic solenoid driver setup. NMOS offers better Rds(on) than PMOS for a given die size so it’s the preferred approach for big coils. But there’s a catch: you will need a high-side gate driver with a boost voltage to make it work with best efficiency. The boost driver lifts Vg high enough to turn the FET on fully.

Here’s a relevant piece about driving solenoids (and a semi-shameless plug for an MPS device): https://www.electronicdesign.com/industrial-automation/what-s-best-way-drive-solenoid

Another way to solve this problem is to use a load switch. This integrates the NMOS FET, charge pump and high-side gate drive all in one convenient IC. There are many good, inexpensive ones designed for USB and general power management.