The Japanese considered this cowardly and deployed their submarines almost exclusively against warships. The USS Yorktown actually survived the Battle of Midway but was torpedoed by a Japanese submarine while being towed back to Pearl Harbor on June 7, 1942.
The Yorktown and its' escorting destroyer Hammann sunk by the same submarine, thus became the last naval vessels sunk in the battle.
“On 2 July, Albacore shifted over to intercept traffic between Yap and the Palau Islands. The submarine spotted a wooden inter-island steamer loaded with Japanese civilians. Albacore decided to stage a surface gun attack. After ensuring the ship was afire, Albacore dived to avoid an airplane. The submarine surfaced soon thereafter and picked up five survivors. The sunken vessel was the Taimei Maru from Yap to Palau.[15]”
https://en.wikipedia.org/wiki/USS_Albacore_(SS-218)
American submarines preyed on anything that flew a Japanese flag.
"About an hour before dawn on December 18, I-17 was moving quietly along the surface 15 miles off Cape Mendocino when one of her lookouts spotted a ship approaching. Kozo Nishino, captain of the 2,500-ton sub, ordered an attack on the American freighter Samoa, which was on her way to San Diego with a load of lumber. "
"Over a seven-day period, from December 18 to 24, 1941, nine Japanese submarines positioned at strategic points along the U.S. west coast attacked eight American merchant ships, of which two were sunk and two damaged".
WTF is your point?
That was their job... A very important job in shutting off the supply spigots to the jap home islands...
Stupidity.
Frustrated Japanese sub commanders complaining about the lack of targets, day after day all that passes by them are troop ships, never a battleship or carrier to actually shoot at.