It's been covered, and probably not much to add to the discussion, but I've got a fair bit of personal experience with buying and being given unused smokeless powder.
The element of risk is a possibility, low probability, but something to consider. The present component shortage has generated a fair number of sales of full and partial containers of unused powder. And the prices seem to be high. As a rule, smokeless powder does deteriorate with age, although at a very slow rate unless stored in less than ideal conditions.
It's been my experience that metal containers are a very poor storage container. The chemicals in the powder tend to react with the metal over time and the powder gets a rusty dust in it. I've heard of reloaders still loading with it, but I will not. I tried "cleaning" the powder but I never came up with a process that I felt comfortable with. The worst candidates are the rectangular IMR cans.
I've used old powder that was stored in the black anti static bags and packaged in a cardboard box, and never had an issue with them. Typically they are 8 # containeres of powder that Hodgdon sld years ago.
As time passes, new reloading data replaces the old data. It's not unusual to find that you may have to use old data for your old powder.
Bottom line, using old powder from dubious sources is something that I would not recommend for the inexperienced handloader. At the least, you should chronograph your loads, to confirm that the data you are using applies to your powder. I've found that I've had to change the charge and select a different primer for different ages of the same powder. Burn characteristics change, albeit very subtly, with time. Not a problem if you test.
I does become a mugs game, IOW, you get a load with a old or perhaps discontinued powder, and the load is very good. Then you run out of that powder, and luckily you find more. Unfortunately it doesn't work as well as the batch you had.
As mentioned, you may get powder in non original containers, my favorite is old tobacco containers, or powder containers with the original label crossed out and a hand written masking tape label half stuck on the side of the container. Or just a jar of powder that the owner says is IMR 3031 or some other name. Then there are the data powders, batches of powder sold as to be used with ###X data.
Personally, I won't as a rule pay retail for old powder. I have on occasion payed up, thanks to supply shortages. There has to be a cost benefit, because of the risks.
I've bought or been given, old made in Scotland 4831, 452AA, Trap 100, 571AA, Red Dot, Blue Dot, Reloader 7, Clays and WST. All were OK to use. On the bad was a bundle of IMR, 4320 and 4350, all rusty. They were free, so not out any $. I think I was the winner on average.
Be careful and cautious.