There's a lot of muddled terminology on the internet
A 5x7 image does have a certain number of
pixels per inch when printed,
determined by how many pixels are in the source file. (
dots are the spots of ink that the printer puts on the page to show the image, and dots per inch the resolution of the ink spot placement)
A jpeg image file doesn't have any physical linear dimensions, so the ppi/dpi field has no real meaning.
You are right that a file that prints at 72ppi at 7x5 inches will look poorer when printed at 10x8 inches, but its no longer being printed at 72 ppi, but at approximately 50 ppi ... but the file itself hasn't changed, it still has the same number of pixels, and that field in the file still says 72ppi/dpi.
A file that prints 30"x20" at 72ppi will look much better printed at 10x8 than the file that prints 7"x5" at 72ppi, because it has far more pixels in it. Its the
number of pixels that matter, not the
quoted ppi/dpi in the file.
(and yes, I know 7x5, 10x8, 30x20 aren't all the same shape, but thats imperial/American standard sizes for you! European sizes are more sensible, except the dimensions are too hard to remember!)