Both file extensions are basically associated with "Real Media" by RealNetworks Inc. These multimedia container formats are created by RealNetworks.
RAM is a short form of Real Audio Media. This extension is used by RealPlayer to play online or offline audio files. Such files normally have the URL pointing to the RM that is the real video binary or the actual audio content. It is compressed with the proprietary RealAudio and RealVideo codecs. Content is stored in the format made by RealNetworks. Get the RealOne player to play its content.
RM or Real Media files used by the RealPlayer also have a video and audio playback and use a streaming program. Such files contain video or audio data or a link to the streaming media files. They are played back as they are downloaded. It is generally used for Internet video and radio. Some of the RM files can be played by the VLC media player that gives partial support to these files.
To compare, download VLC Player and see all its features.
RAM files are real media audio ones with media. That means it is a video with sound. This file extension on other hand is a real media movie meaning a video without sound.
These files are made for Internet use. They are used as condensed files that can be accessed from websites. The main reason for that is economy on traffic or bandwidth and also web space for webmasters. And most importantly it saves the download time for the users accessing these files. However such files cannot be used for other purposes and if you convert them to other formats, the quality will suffer. But you can try to rename the extensions for the files that would not open in the software you use.