Does macOS come with (the ruby framework) rails?
No, macOS does not come with rails preinstalled.

On a default clean install of macOS Catalinia, if you run the following command in Terminal, you'll see that rails is not installed by default.

% rails -v
Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.
% 


I also tested this on some earlier versions of macOS and the result was the same.

If rails -v returns version info, then it's installed, but was done after macOS was originally installed.