It is true there is no Immigration when you depart the US but everything these days is done electronically. Airlines share APIS with CBP on arriving and departing passengers. Yes, Officers do look through the passport and through questioning, can determine past entries and length of stays.