I don't think there is any limit on how long the cord can be from a realistic standpoint. But with extension cords, there is a practical limit in that the darned things can be so long that they get tangled and are otherwise awkward and cumbersome.
To that end, the longest cord I get is thirteen feet (a standard size that you can buy over the counter). Go with twenty-five feet (also a standard size you can buy over the counter) and you are always struggling with managing the cord. It's a pain in the neck.
I have used a modular crimping tool to make ones longer much longer than that when someone was insistent about it. But why do that when you can just run standard telephone wire to an RJ-11 jack somewhere in the vicinity of where they want their phone located? I still discourage those excessively long telephone cords.
As far as the wire from the C. O. is concerned, I believe there is a limit before the phone company makes it four wire most of the way to the premises. But I don't remember what that length is. I'd be willing to bet it is pretty long.