In this paper, the optimal operation of a neighborhood of smart households in terms of minimizing the total energy procurement cost is analyzed. Each household may comprise several assets such as electric vehicles, controllable appliances, energy storage and distributed generation. Bi-directional power flow is considered both at household and neighborhood level. Apart from the distributed generation unit, technological options such as vehicle-to-home and vehicle-to-grid are available to provide energy to cover self-consumption needs and to inject excessive energy back to the grid, respectively. The energy transactions are priced based on the net-metering principles considering a dynamic pricing tariff scheme. Furthermore, in order to prevent power peaks that could be harmful for the transformer, a limit is imposed to the total power that may be drawn by the households. Finally, in order to resolve potential competitive behavior, especially during relatively low price periods, a simple strategy in order to promote the fair usage of distribution transformer capacity is proposed.