I understand that there is a 40mA limit on the digital outputs,
but if I have for experimental purposes a pot reading into an analog input connected to GND and 5V rails, what is a safe value for the pot?
Those two things are not related in any way, they are two totally different things.
One is how much current an arduino OUTPUT can source and sink. The other I suspect is asking about INPUTS these are totally different conditions even though they use the same pins.
When a pin is an input (analogue or digital), it takes in very little current for 5V supplied to it so don't worry about putting too much current into an input, you can't unless you take it over 5V which will blow it anyway. For the analogue input testing a 10K pot (or less) is best because it gives the input capacitor enough time to charge when switching input channels.
As lefty says what it does to the pot is another matter.