It all comes down to the size (will it fit in the OEM tray?) and the post (positive / negative) orientation (will your OEM cable/hook-ups match the location of each on the battery?).
IMO, if it’s a regular lead acid battery, probably not worth the effort. An AGM dual purpose/deep cycle battery of the same or greater size and specs to the OEM battery is preferred and more of an upgrade. AGMs usually have outstanding 3-4+ warranties.
You can trade in the core to the vendor after you purchase the new battery. You’ll likely get a core charge refund around $10-30. Not much. Most vendors actually advertise battery prices with the core charge/refund factored in (read the fine print). If a battery is listed at say, $200, that is likely with the core charge/refund. In reality, you’d pay $220, or so, before taxes and get the refund when you bring back your old battery.
If the battery is not old and near new. You may be able to sell secondhand via Facebook marketplace or similar and fetch a price closer to it’s newer, actual value. The battery build date should be printed somewhere on the battery casing to prove its age. Keep it on a battery charger/monitor periodically to keep the battery’s health in good condition - you do not want it to deplete its charge (doing so will damage the unit).
Yes. I believe they are mandated to do this via regulation, just like the motor oil example you mentioned; i.e., if your storefront sells batteries, you must in turn accept used batteries for recycling.