How can two laptops have the same resolution and screen size but different pixel densities?
They can't, some parameters have been reported incorrectly. You can verify this yourself as follows.
There is a convenient pixel density calculator at this website. The calculation is trivial (from wikipedia)
Using this formula and/or the online calculator shows that for the X250 to have a ppi of 183 with a resolution of 1920x1080 it would need to be a 12" screen, not a 12.5" screen.
Using the value of 12" instead of 12.5" comes out to almost exactly 183 ppi while 12.5" comes to 176.
So either the manufacturer has redefined ppi, or they are not reporting the resolution or screen size accurately.
I believe this is probably an error on the Specout site. The comparison at specout reports that the two models have identical resolutions and sizes, but different PPI densities. However I can't find this claim being made anywhere on the Lenovo site. Other laptop review sites don't reproduce this claim either. Notebookcheck.net reviews for the X250 and X260 give them the same graphics specs. The point is probably moot, since the X250 is actually a discontinued model, and the X260 is apparently its successor.