In California (and I believe many other states), what you describe would be considered a speed trap, and it isn't allowed. Speed limits are supposed to be set by measuring how fast people drive on the roads. If 85% of drivers go 40, then that's the speed limit. If a city/county hasn't surveyed a street recently, then an officer cannot park their vehicle and hand out tickets for speeding (though they can give a ticket if they are driving their vehicle and see someone speeding) - because that could be a speed trap.
In 2016, the speed limit was enforceable on only 19% of streets in Los Angeles due to the speed trap law. The city has made great efforts recently to update their speed surveys, resulting, in most cases, in an increase in speed limits.