On some local trains (TER), it's effectively possible to buy a ticket on-board for a higher fare (which is still 30-40% over the regular fare!). It's typically presented as a last resort rather than a service or regular sales channel (which is also why the SNCF is not especially forthcoming with this information) but there is a distinction between this situation and being fined because you don't have a ticket.
It's possible in the following provinces (they advertise it):
It's definitely not possible in the following provinces (the full fine is due even if you approach the train guard yourself):
As far as I can tell, the website is unclear regarding Brittany, Grand-Est, Nouvelle-Aquitaine, Pays-de-la-Loire, and Sud-Provence-Alpes-Côtes-d'Azur.
Before 2019, I think it was also possible to buy a ticket everywhere if you boarded a train at a stop with no staff (or maybe with no vending machine?) but now it depends on the province. If the province is not forcing it to offer this possibility, the national train company is pushing hard against it.
The rule on long-distance trains is that you have to buy a ticket before boarding the train but there is still an announcement inviting anybody with ticket issues to make themselves known as soon as possible (or something to that effect, don't remember the exact wording). I am not sure how much leeway train guards have nowadays but it was sometimes enough to secure a reduced fine (that's the distinction between a “tarif bord” and “tarif contrôle” that is still found in some documents) or avoid the fine entirely. Don't get fooled into thinking that this announcement means that buying a ticket on board is expected, though.
Overall, this is clearly not encouraged so I would assume it's not possible and always try to buy a ticket before boarding the train, if at all possible (and not merely inconvenient). If I could not buy a ticket, I would still approach the train guard as soon as possible.