Both gramophone and phonograph could be used for any sound recording device, and have been used interchangeably.
Because the words were used by different inventors (sometimes as all or part of a brand name), the distinction is sometimes made where phonograph refers specifically to cylinder-based devices and gramophone to disk-based devices. (Some other terms that were specific to brands such as zonophone have pretty much died out entirely unless one is talking about the history of that precise brand).
Gramophone: Any sound-recording device, or device for playing previously-recorded sounds, especially if it uses a flat spinning disk.
Phonograph: Any sound-recording device, or device for playing previously-recorded sounds, especially if it uses a spinning cylinder.
As such, they would be used interchangeably by some, while others would use them as quite distinct.
As technology moved on and the cylinder-based approaches died out, then while some would still distinguish between the two in this way, they were mostly interchangeable because the flat disk approach was the only approach in current use.
As technology moved on further and first magnetic and later optical and digital storage become more common, the words in their wider senses (that allowed them to be used interchangeably) didn't move with them, so the two terms got stuck at the stage of progress where spinning disks that were physically read by a needle (unlike the spinning disks of minidisc or compact disc).