The short answer to your question is you should check the "staying" box since the purpose of your layover is to visit friends. The duration of this layover is not important according to US immigration laws. What matters is the purpose.
See below for the explanation.
Defining Transit vs Stay
I believe that the temporal definition of "to transit" and "to stay" do not apply in this case. The difference between the two lies not in the duration of your permanence at a given place.
I think "transit" means that you remain in the international area of the airport, thus you never really enter the country. Whereas "staying" means that you go through immigration checks and exit the international area of the airport. Thus you effectively enter the country.
US Transit vs Visit
I could not find a true air-travel-related definition, however there is a page explaining what a US transit visa is (thanks @HenningMakholm), from the US Bureau of Consular Affairs. Here a clear definition is made between the transit visa, which allows you to layover in the US for transit purposes only, and a visitor visa, which allows to layover in the us for the purpose of visiting friends.
This seems to apply directly yo your case:
Travel purposes not permitted on a Transit (C) Visa - Examples:
A foreign citizen whose layover in the United States is for a primary purpose other than to transit, for example to visit friends or sightsee, requires a visitor (B) visa.
So to answer your question you should check the "staying" box, even if you plan on departing 24 hours after entering the country, since you are visiting friends.
Schenghen Transit vs Visit
Similar concepts apply within the Schenghen area. There are transit visas which allow you to remain in the transit area of the airport, and the short-term visa which allows you to exit the transit area to go sleep in a hotel. Quoting the website:
Therefore you would not be considered "in transit" if you spent a night anywhere outside the international area of the airport.
UK Transit Visas
Thanks to this answer I now have new information regarding yet another particular situation: the UK.
The UK has two types of transit visas:
Visitor in Transit Visa
Apply for this one if you are going through immigration, i.e. if you are effectively crossing the border into UK. This can be because you have to check-in your luggage on a connecting flight, because you want to visit friends, or do sightseeing. Maximum validity is 48h.
Direct Airside Transit Visa
Apply for this one if you are changing flights without having to go through immigration.