We study a finite group G with the following property: for any of its maximal subgroups H, there exists a subgroup H-1 such that vertical bar H-1 vertical bar = vertical bar H vertical bar and H-1 is an element of F, where F is the formation of all nilpotent groups or all supersoluble groups. We prove that, if F = N is the formation of all nilpotent groups and G is nonnilpotent, then vertical bar pi(G)vertical bar = 2 and G has a normal Sylow subgroup. For the formation F = U of all supersoluble groups and a soluble group G with the above property, we prove that G is supersoluble, or 2 <= vertical bar pi(G)vertical bar <= 3; if vertical bar pi(G)vertical bar = 3, then G has a Sylow tower of supersoluble type; if vertical bar pi(G)vertical bar = 2, then either G has a normal Sylow subgroup or, for the largest p is an element of pi(G), some maximal subgroup of a Sylow p-subgroup is normal in G. If G is nonsoluble and, for each maximal subgroup of G, there exists a supersoluble subgroup of the same order, then every nonabelian composition factor of G is isomorphic to PSL2(p) for some prime p; we list all such values of p.