If you do a panel change and the existing range is fed with #10, can you still use a 40 amp breaker?

How about if the customer wants a range plug installed, and you find it's fed with a #10 on a 40 amp breaker. Can you install the receptacle?

I thought it was from before the 70's until this week I found it in a row of 8 condos that were built in the 80's or 90's. It seems the rules might not be rigidly enforced.