The superscripts in Roman numeral analysis come from figured bass notation. This was a notation used in the Baroque period that allowed the continuo player (e.g. harpsichordist, organist, lutenist, ...) to improvise over the written bass note by using the given notes above the bass. Continuo parts were not written out, because they didn't always know what instrument would be playing them, and they wanted to allow maximum flexibility.
For example, a figured bass 53 means a root position triad, whereas 63 means a first inversion triad, and 753 means a 7th chord. But the 5 and the 3 became so common that they were omitted; thus root position now no longer has any numerals, whereas first inversion has only 6. Finally, 7th chords are now denoted 7.
All figures (not just 7ths) were understood to be in the current key, i.e. without introducing new accidentals. For example, in the key of C major, a ii6 is a ii chord in first inversion, i.e. (bottom to top) F, A, D, or F, D, A (figured bass does not distinguish between these).
By going through the different possible 7th chords (among which, in major, ii7, IV7, V7, and vii ø7 are the most common), you can easily see which 7th chord has which chord quality: ii7 is a minor seventh chord, IV7 is a major seventh chord, V7 is a dominant seventh, and vii ø7 is a half-diminished seventh.
You can alter the quality of the seventh chord by adding accidentals to the figured bass, e.g. ♭7 instead of 7. But in certain cases, it is more natural to write the harmony as an applied harmony instead; for example I ♭7 is really V7/IV, and II 7 ♯3 is really V7/V.
In minor, the situation is exactly the same, except with some conventions around the leading tone. Technically one should write V 7 ♯3 to indicate the dominant seventh chord, but the ♯3 became understood, so the notation simplified to V7. The situation is similar for chords based on ♯vii° (leading tone diminished chords): the ♯ in front gets dropped because it is understood. But beware that other chords (like III) can still have the lowered 7th scale degree in it.