Its definitely not legal, but you could get away with it in the south end in the off season. Otherwise I could see sleeping in the dunes up past the 59Th street pier in Corson's (spelling) Inlet State Park. There are all sorts of trails and coves in there. I know back..way back when I was a teenager when we use to drink on the beach they patrolled it at night in a truck. When you saw the headlights grab the booze and start running for the streets.
a really good place to drink on the beach is at 29th st by the little sailboats. the sand dune kinda wraps around into the beach and makes a little cove. you can see the lights coming and hear the 4 wheelers and have plenty of time to take the cooler back to the street. But camping is a different story...probably have to go way beyong 59th st.