With the progressive addition of microgrids at the distribution level, complex networks of interconnected microgrids and the utility grid are likely to emerge. In such a scenario, advanced microgrid controllers are required to achieve operational stability objectives while maintaining a cost-effective operation. This paper investigates the control strategies, trading mechanisms, and interconnection configurations of a multi-microgrid and utility grid system for frequency stability analysis and operational cost optimization. The analysis is performed on a model of two interconnected microgrids and the utility grid, all possible interconnection configurations are tested. A robust controller is designed and the control parameters are later optimized to ensure that the frequency stability of the system is maintained under normal operating conditions and under various disturbances. A new control element based on switching between interconnection configurations is introduced to handle the power that flows between microgrids, aiming to minimize inter-microgrid energy trading cost while maintaining the system frequency fluctuations within tolerance levels. The effectiveness of the designed controller is demonstrated in this work. This work is expected to provide new insights in the field of multi-microgrid system design.