The second version is closer. The FAA line isn't about whether cash changes hands, it's about whether the flight serves a business purpose. Aerial images used to market a property for sale are marketing material, so flying to produce them is commercial operation under the FAA's small drone rules and calls for a remote pilot certificate under Part 107. You doing it as a favor for an agent doesn't change what the images are for. The rules and the exam content do get updated, so confirm the current requirements directly with the FAA rather than relying on a forum post, mine included.
There's a second layer people miss. The certificate lets you fly, and it doesn't get you into controlled airspace on its own. Near an airport you need an airspace authorization, which for many locations comes through an automated system in minutes and for others takes a real request and real waiting. A lot of suburban listings sit inside that controlled airspace without anyone realizing it, so check the location before you promise the agent a photo.
On insurance, drone liability is usually written separately from a general business policy, and some brokerages ask to see it before they'll let a vendor fly over their listing. Worth having the paper in hand.
The practical route most photographers take on their first few aerial jobs is to subcontract a certified pilot for $100 to $250 a flight, quote the aerials as an add-on, and study for the certificate in the meantime. You keep the client relationship and you're not the one holding the controller while you're unsure of the rule.