Confusingly, the font names used internally (the app talking to the OS) are often not the same. So, the default font used to render $Text may be 'Mercury SSm', yet the stored value of $TextFont would be 'MercurySSm-Book'. Not the same exact string.
UI like the Inspector and Document Settings controls that set Font-type attributes use a button that opens the macOS Fonts palette. The selection made in the latter correctly sets the font name stored as the attribute's value.
For the Displayed Attributes table and Get Info/attributes, any Font-type attribute shows an 'A' symbol button between the attribute's name and its value. Clicking on the button opens the macOS Fonts palette. Selecting a font in the latter stores the correct address in the attribute.
How to know the correct value for setting a font-type attribute via Action code
If the desired value is already stored in an attribute, simply copy/paste the value as a quoted string value to use in the action code.
Otherwise, the sensible course is to use a dummy Font-type attribute in the current TBX to set and copy a value—do not forget to delete the attribute when done! Or make a new unsaved TBX document set any system Font-type font to the desired font then copy/paste the value to action code: when done, close/delete the unsaved TBX.
How to store valid font string in non-Font-type attributes
As fonts essentially store a string, a String-type attribute can hold a font name. To ensure the value is correct, if not storing a known valid value use the method in the section above to derive a correct font 'name' and then store that in the String-type attribute, e.g. for use in action code, etc.