A pixel-style digital image file doesn't really have any inch dimensions associated with it, only pixel dimensions. Thus basically it is not meaningful to speak of a resolution (in pixels per inch, or dots per inch as it is usually called in this context).
But there are cases in which it is meaningful, in which an inch size is associated with the image. Imagine that a graphic artist has been commissioned to design a new label for a pickle jar. The label will be 2" wide x 3" high, and the client wants the deliverable image file to have a resolution of 300 dpi at that size (and "at that size" is critical here).
The artist sets up the "canvas" in the drawing program to be 600 pixels wide and 900 pixels high, and proceeds to design the label. If he sends the file to a service bureau to have a proof printed on a spiffy printer, he can either say, "print this at 2" x 3"", or "print this at a resolution of 300 dpi at its native pixel dimensions". But if somebody "found" the file, they couldn't tell if it was for a 2" x 3" label or a 3" x 4.5" label.
In order to facilitate this kind of transaction, the developers of modern image file formats decided to include in the "header" of the file a pair of resolution indicators, one for the horizontal direction and one for the vertical (for cases where those might be different). Thus, our pickle jar label file would carry the value 300 dpi for Xresolution and Yresolution.
But an image from a digital camera doesn't carry any implication of an inch size. We do not instruct the camera, via its menu system, "I want this next shot to be thought of as being 6" wide x 4" high. Thus no resolution in dpi is meaningful.
The definers of the file formats, to accommodate this situation (which they politely describe as "resolution is unknown"), prescribe that in such a case the value 72 dpi be used.
Where does that number come from? It turns out that in the early days of graphics work on personal computers, a typical monitor screen size and a typical screen pixel resolution produces a spatial resolution of about 72 dpi. Does that really relate to what we are talking about? No, but that's where they got the number.
So we might expect that digital cameras, for which a resolution indicator isn't meaningful, would all carry the value 72 dpi. In actuality, they carry an arbitrary value chosen by the manufacturer based on some thought process not yet revealed to us. In the Canon EOS-300D, it is 180 dpi. In the Kodak DC210, it is 216. In the Kodak DC4800, it is 230. In the Fuji S602, it is 72!
But what do those values mean? Do they tell us the resolution of the image in dots per inch? The answer is no. The image doesn't have one unless it is given physical form by printing it. Would the values be the resolution in dots per inch if the image is printed? Well, only if we print it at the "right" DPI. For example, if the image from a Canon EOS-300D has size 3072 x 2048 pixels, and we print it at size 20" x 25", it will indeed have a resolution of 180 dpi. But so what?
Now we often hear of how useful the dpi indicator is in manipulating images in photo editors and arranging for them to print at the desired size. For example, for the 3072 x 2048 pixel image mentioned above, which entered the editor announcing its resolution as 180 dpi (and thus claiming to have a "real" size of 20" x 15"), and our editor plans print jobs on the basis of "percent of real size", and we want a print that is 3" x 2", we can just tell the program, "print this at 10% of real size".
On the other hand, if I had tampered with the file and set the resolution indicators to 180, then the very same image (3072 x 2048 pixels) would claim to have a real size of 40" x 30". If we want to again print it to a size of 3" x 2", we can just tell the program, "print this at 5% of real size". But the result is identical in the two cases.