In a comment you ask
if a singer were to sing an F-major scale using just intonation, would they sing an A♯ or a B♭ ?
The answer is B♭, for reasons well explained in other answers. But the question seems to assume a strict relationship between note names and tuning that does not exist.
If a singer were to sing an F major scale in just intonation, the B-flat would be about 2 cents lower than equal-tempered, a negligible difference in almost every context. The A, however, would be approximately 14 cents lower than equal-tempered. However, the medieval system is far more likely to have been developed using Pythagorean tuning than just intonation. One clue to this is that they tended to treat the major third as a dissonance. (Another clue is medieval writings about tuning.) The Pythagorean major third is about 8 cents higher than equal (and 8+14 cents gets you a syntonic comma). Whichever A we use, however, wherever it is between 386 cents above F and 408 cents above, we still call it A.
In other words, you seem to assume that the "black" notes are the most flexible in their tuning, but that isn't necessarily the case. In the major scale, the third, sixth, seventh, and second scale degrees are the most unstable for use in harmonic music.
But my understanding is that historically at least, sharps and flats would differ by a comma?
"Comma" is a whole class of intervals (the very small ones), so yes, this is true in the sense that bread is made from a plant. But normally, the word "comma" by itself, in the context of just intonation, denotes the syntonic comma, and that's not the difference between two enharmonically equivalent pitches; rather, it's the difference between the A that is a major third above F and the A that is a perfect fifth above D (specifically, above the D that is a perfect fifth above G). More generally, it's the difference between four perfect fifths and a major third, after adjusting to the same octave. Four perfect fifths is (3:2)4, or 81:16, while two octaves plus a major third is 5:1 or 80:16, giving 81:80 for the syntonic comma.
And this brings us to another point: the specific tuning of any pitch in pure just intonation depends on how you get there. Sharps are normally the major third of a chord, while flats are normally either a perfect fourth above something or the root of a major chord whose third has already been established.
So, tuning from C, your B♭ can be two perfect fourths, 16:9, or a perfect fifth plus a minor third, 9:5. That's already a syntonic comma difference without considering A♯.
For a more plausible example that is easier to calculate, as well as less ambiguous, let's consider, with C as our base note, C♯ as the leading tone to D, and D♭ as the major third below F:
Pitch Ratio Cents
F 4:3 498
D 9:8 204
D-flat (4:3)*(4:5) = 16:15 112
C-sharp (9:8)*(15:16) = 135:128 92
Here, the difference between C♯ and D♭ is slightly less than a syntonic comma. But if you figure C♯ as a major third above A (the one that's a third above F), you get a very different result:
Pitch Ratio Cents
F 4:3 498
D 9:8 204
D-flat (4:3)*(4:5) = 16:15 112
C-sharp (5:6)*(5:4) = 25:24 71
This difference between C♯ and D♭ is just under two syntonic commas (which is not surprising, since the A we based it on is a syntonic comma flatter than the perfect fifth above our D).
Basically, for most music, you run into this kind of confusion very quickly if you try to tune everything in pure just intonation. Some pieces are "comma pumps" in which the harmonic progression causes the pitch to change if you keep all the intervals pure.
This difficult problem becomes all the more difficult when trying to tune a keyboard. Singers can sing a different A depending on whether it's part of an F major chord or some sort of D chord. Unfretted string players can do the same. Wind instruments can bend the pitch up and down. Fretted strings can bend it up. But, aside from the clavichord (and modern electronic instruments!) keyboardists cannot do this.
Furthermore, the difficult problem becomes still more difficult when you consider playing different pieces on the same instrument, and intractable when you try to tune for different keys.
One solution to this problem was keyboards with split keys. But that's only a partial solution to the problem, because, as we've seen, even if you have separate keys for (e.g.) G♯ and A♭, you might need more than one pitch for G♯ or for A♭.
The other solution, the one that stuck in the long run, was to temper the just intervals so they're all a little bit out of tune but tolerable. There's a common myth that holds that formerly (at some unspecified time) everything was tuned in just intonation, but that only sounded good in one key, so eventually we discovered temperament in order to play in every key.
But as we've seen, you can easily run into tuning trouble in just one key, with no chromaticism at all. Tempered tunings must have been in use from the first time anyone tuned a keyboard with a just major third, because as soon as you do that, you mess up at least one of your fifths. Initially, these would have been meantone temperaments, which resolve the problem of the unstable A, and really do sound good in a small number of closely related keys while sounding bad in others. It was meantone temperament, not just intonation, that drove the development of split-key keyboards. As harmonic complexity increased, keyboard temperaments became gradually more equal, and split keys lost their purpose.
All of this is intended to complement the other answers by pointing out that tuning considerations are far more complicated than, and separate from, the question of whether to use A♯ or B♭ as the fourth degree of the F major scale. The choice between enharmonic equivalents is more about melodic logic, in a fairly abstract theoretical way. The choice of a particular tuning for a particular pitch is about what sounds best, in a concrete practical sense.